-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unlimited points via keyboard #1570
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
Size Change: +406 B (+0.05%) Total Size: 861 kB
ℹ️ View Unchanged
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1570 +/- ##
==========================================
+ Coverage 70.34% 70.76% +0.42%
==========================================
Files 521 544 +23
Lines 107316 111334 +4018
Branches 5513 11890 +6377
==========================================
+ Hits 75489 78791 +3302
- Misses 31711 32543 +832
+ Partials 116 0 -116 see 1065 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
The parent pull-request (#1567) has been merged into |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (c3ebead) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1570 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1570 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, and I love the way it works. But I'm wondering if there's a simpler way to accomplish this (with no added reducer state). I left comments inline.
}} | ||
ref={graphRef} | ||
tabIndex={0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the graph be focusable with the tab key? If we want it to be programmatically focusable but not tabbable, we could set tabIndex={-1}
. (MDN docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-fitzgerald and @nishasy thought it should be 0 because we expect it to be tab-able. Nisha has future work that uses that!
if (event.key === "Backspace") { | ||
dispatch(actions.global.deleteIntent()); | ||
graphRef.current?.focus(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still a little confused about why we have to handle this event on the graph component rather than on the point itself. I tried adding an onKeyDown
handler to the g[data-testid='movable-point']
element and it works in both Edge and Safari. The focused point's event handler is fired when you press a key.
The advantage of putting the event handler on the point would be that we wouldn't have to keep track of which point is focused in the useReducer state.
Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely open to changing it but there are a couple of things I like:
- This lets us add a delete intent to other kinds of graphs with no fuss. I think we'll use that for unlimited polygon (but that's a gut feeling).
- This makes it natural to add other keyboard shortcuts and gives a natural place for them to live
- I think I need to know the selected point regardless of this change. After a point is added we want to focus on the newly added point. So as a learner I tab to the "Add point" button, hit space, the point is selected and I can manipulate it with my keyboard. I think that means we'll need to keep track of the selected point so that after the add button is activated we select the right thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Major Changes - [#1577](#1577) [`c875acd01`](c875acd) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove example widgets and their editors ### Minor Changes - [#1570](#1570) [`c4432ffad`](c4432ff) Thanks [@nicolecomputer](https://github.com/nicolecomputer)! - Remove unlimited points via keyboard - [#1582](#1582) [`377b7ce68`](377b7ce) Thanks [@aemandine](https://github.com/aemandine)! - Add save warnings to PhET widget editor and un-hide widget from content editor widget dropdown ### Patch Changes - [#1578](#1578) [`78bb8573e`](78bb857) Thanks [@aemandine](https://github.com/aemandine)! - Remove simpleValidate from PhET widget - [#1585](#1585) [`a6ec402c0`](a6ec402) Thanks [@handeyeco](https://github.com/handeyeco)! - Reorganize files in the widgets folder - [#1589](#1589) [`d56952564`](d569525) Thanks [@aemandine](https://github.com/aemandine)! - Make PhET widget smaller - [#1587](#1587) [`8015cdefb`](8015cde) Thanks [@aemandine](https://github.com/aemandine)! - Tidying up PhET widget - [#1583](#1583) [`615567bd2`](615567b) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove sort-comp exceptions and reorder components ## @khanacademy/[email protected] ### Major Changes - [#1577](#1577) [`c875acd01`](c875acd) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove example widgets and their editors ### Minor Changes - [#1582](#1582) [`377b7ce68`](377b7ce) Thanks [@aemandine](https://github.com/aemandine)! - Add save warnings to PhET widget editor and un-hide widget from content editor widget dropdown ### Patch Changes - [#1585](#1585) [`a6ec402c0`](a6ec402) Thanks [@handeyeco](https://github.com/handeyeco)! - Reorganize files in the widgets folder - [#1587](#1587) [`8015cdefb`](8015cde) Thanks [@aemandine](https://github.com/aemandine)! - Tidying up PhET widget - [#1583](#1583) [`615567bd2`](615567b) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove sort-comp exceptions and reorder components - Updated dependencies \[[`78bb8573e`](78bb857), [`a6ec402c0`](a6ec402), [`d56952564`](d569525), [`c875acd01`](c875acd), [`8015cdefb`](8015cde), [`c4432ffad`](c4432ff), [`615567bd2`](615567b), [`377b7ce68`](377b7ce)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1585](#1585) [`a6ec402c0`](a6ec402) Thanks [@handeyeco](https://github.com/handeyeco)! - Reorganize files in the widgets folder
Summary:
remove-point-keyboard.mov
Remove unlimited points via keyboard.
Issue: https://khanacademy.atlassian.net/browse/LEMS-2280
Test plan: