-
Notifications
You must be signed in to change notification settings - Fork 351
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
[Interactive Graph] Polygon side snapping is keyboard accessible. #2270
Conversation
…and mouse behavior.
… we keep it whole numbers.
Size Change: +1.41 kB (+0.16%) Total Size: 874 kB
ℹ️ View Unchanged
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (1794604) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR2270 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR2270 |
…olygons to be keyboard accessible.
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.
This looks good overall! Thanks for this huge accessibility improvement!
Requesting changes because coords
is being mutated in the reducer; we should make a copy instead. I left a few other suggestions inline too.
packages/perseus/src/widgets/interactive-graphs/reducer/interactive-graph-reducer.ts
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/graphs/polygon.tsx
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/interactive-graph.testdata.ts
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/__snapshots__/interactive-graph.test.tsx.snap
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/reducer/interactive-graph-reducer.ts
Outdated
Show resolved
Hide resolved
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.
Thanks for the updates! LGTM!
I left a couple small questions and suggestions inline, but nothing blocking.
@@ -302,7 +302,7 @@ export const polygonWithFourSidesSnappingQuestion: PerseusRenderer = | |||
.withGridStep(0.5, 0.5) | |||
.withSnapStep(0.25, 0.25) | |||
.withTickStep(0.5, 0.5) | |||
.withMarkings("none") | |||
.withMarkings("graph") |
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.
Why did these values change? In general, I think we should be pretty cautious about changing existing values in these testdata files, since they are shared between tests and any changes could cause tests to pass for the wrong reason.
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.
Oh okay, I can revert them. I updated them because I found debugging very challenging for these testdata examples and I'm curious why we don't want it to have any markings?
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.
Ah, I believe I added "none" markings when I migrated over old data to use the builder. This data was probably originally taken from an existing question, dumped in the testdata, and never changed. And then I did a 1:1 update to the builder.
As far as use of this testdata goes, I don't think these are being used to test markings anywhere. I support removing the withMarkings
call altogether for any of them that say "none"
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.
Yay! I'll add them back in a follow-up PR.
packages/perseus/src/widgets/interactive-graphs/reducer/interactive-graph-reducer.ts
Outdated
Show resolved
Hide resolved
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! Just left one small suggestion, but this looks great.
packages/perseus/src/widgets/interactive-graphs/math/box.test.ts
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/math/box.test.ts
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/math/box.test.ts
Outdated
Show resolved
Hide resolved
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/math-input@23.0.0 ### Major Changes - [#2226](#2226) [`909148cdc`](909148c) Thanks [@handeyeco](https://github.com/handeyeco)! - Answerless Expression: Expression can render and is interactive with answerless data ### Patch Changes - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 - @khanacademy/keypad-context@1.1.1 ## @khanacademy/perseus@56.0.0 ### Major Changes - [#2233](#2233) [`a0aee41b6`](a0aee41) Thanks [@handeyeco](https://github.com/handeyeco)! - RadioWidget v2 in support of answerless Radio ### Patch Changes - [#2279](#2279) [`e02cc4109`](e02cc41) Thanks [@nishasy](https://github.com/nishasy)! - [SR] Tweak strings for Segment and Angle graphs - [#2270](#2270) [`941343ee3`](941343e) Thanks [@catandthemachines](https://github.com/catandthemachines)! - Fixing side snapping within polygons to be keyboard accessible. - [#2226](#2226) [`909148cdc`](909148c) Thanks [@handeyeco](https://github.com/handeyeco)! - Answerless Expression: Expression can render and is interactive with answerless data - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 - @khanacademy/math-input@23.0.0 - @khanacademy/keypad-context@1.1.1 - @khanacademy/kmath@0.4.1 - @khanacademy/perseus-linter@1.3.1 - @khanacademy/perseus-score@2.3.1 ## @khanacademy/perseus-core@5.0.0 ### Major Changes - [#2233](#2233) [`a0aee41b6`](a0aee41) Thanks [@handeyeco](https://github.com/handeyeco)! - RadioWidget v2 in support of answerless Radio - [#2226](#2226) [`909148cdc`](909148c) Thanks [@handeyeco](https://github.com/handeyeco)! - Answerless Expression: Expression can render and is interactive with answerless data ## @khanacademy/perseus-editor@17.9.0 ### Minor Changes - [#2226](#2226) [`909148cdc`](909148c) Thanks [@handeyeco](https://github.com/handeyeco)! - Answerless Expression: Expression can render and is interactive with answerless data ### Patch Changes - [#2233](#2233) [`a0aee41b6`](a0aee41) Thanks [@handeyeco](https://github.com/handeyeco)! - RadioWidget v2 in support of answerless Radio - Updated dependencies \[[`e02cc4109`](e02cc41), [`941343ee3`](941343e), [`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus@56.0.0 - @khanacademy/perseus-core@5.0.0 - @khanacademy/math-input@23.0.0 - @khanacademy/keypad-context@1.1.1 - @khanacademy/kmath@0.4.1 - @khanacademy/perseus-linter@1.3.1 - @khanacademy/perseus-score@2.3.1 ## @khanacademy/keypad-context@1.1.1 ### Patch Changes - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 ## @khanacademy/kmath@0.4.1 ### Patch Changes - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 ## @khanacademy/perseus-linter@1.3.1 ### Patch Changes - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 ## @khanacademy/perseus-score@2.3.1 ### Patch Changes - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 - @khanacademy/kmath@0.4.1 ## @khanacademy/perseus-dev-ui@5.3.1 ### Patch Changes - Updated dependencies \[[`a0aee41b6`](a0aee41), [`909148cdc`](909148c)]: - @khanacademy/perseus-core@5.0.0 - @khanacademy/math-input@23.0.0 - @khanacademy/kmath@0.4.1 - @khanacademy/perseus-linter@1.3.1 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Summary:
Updating Polygon interactive graph implementation to have keyboard accessible side snapping. This is done by hooking up the side snapping behavior into a constraint function to make to keyboard arrow keys.
Issue: LEMS-2243
Test plan: