-
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
feat(LEMS-2662): handle angle aria label updates #1940
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (9d478da) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1940 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1940 |
Size Change: +723 B (+0.06%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
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 is exciting!
Requesting changes because we're ultimately going to want a different approach to aria-live notifications (see my inline comment about avoiding useState and building for the upcoming Wonder Blocks API) and I'd prefer to start designing for that now.
updateVertexAriaLabel(coords[1]); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [showAngles]); | ||
|
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 think we could avoid using the useState
and useEffect
hooks here if we:
- compute aria labels from the
graphState
prop - use aria-live to notify the user of changes to the graph
This would ensure that the SR view and the visible view never get out of sync, since both would be pure functions of graphState
. Currently, all the individual graph components are stateless (or nearly so — there are a couple useState
s for hover and dragging effects) and I'd like to keep it that way.
Wonder Blocks is planning an API for sending aria-live notifications, but since it's not built yet, I think what we could do is write a minimal implementation of the same API and swap in the WB one when it's ready. I'd be down to pair or consult on that if you want.
packages/perseus/src/widgets/interactive-graphs/graphs/components/angle-indicators.test.ts
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/graphs/components/angle-indicators.tsx
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/graphs/components/angle-indicators.test.ts
Outdated
Show resolved
Hide resolved
packages/perseus/src/widgets/interactive-graphs/graphs/components/angle-indicators.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Ben Christel <[email protected]>
Summary:
Issue: LEMS-2662
Test plan:
Testing Steps
Angle
Show angle measures
and move pointsAllow reflex angles
and move pointsExpected behavior
Show angle measures
is not enabled, screen reader does not read out angle measureShow angle measures
is enabled, angle measure is read out with vertexShow angle measures
andAllow reflex angles
are enabled, Screen Reader reads out reflex anglesScreen Recordings:
Without angle measures
Screen.Recording.2024-12-03.at.14.53.13.mov
With angle measures
Screen.Recording.2024-12-03.at.14.53.53.mov