[Interactive Graph] Add WB Announcer to Linear graph#3683
Draft
catandthemachines wants to merge 2 commits into
Draft
[Interactive Graph] Add WB Announcer to Linear graph#3683catandthemachines wants to merge 2 commits into
catandthemachines wants to merge 2 commits into
Conversation
Contributor
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (438d8c3) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3683If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3683If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3683 |
Contributor
|
Size Change: +167 B (+0.03%) Total Size: 506 kB 📦 View Changed
ℹ️ View Unchanged
|
| return `${srCircleRadiusPointLabel(state.x, state.y, state.centerX, strings, locale)} ${strings.srCircleRadius({radius: state.radius})}`; | ||
| case "move-center": | ||
| return srCircleCenterLabel(state.x, state.y, strings, locale); | ||
| case "move-linear-point": |
Member
Author
There was a problem hiding this comment.
Nit: Let me consolidate this with the generic move-point announcement. No need to duplicate if it's the same.
| } | ||
| case "linear": | ||
| case "linear": { | ||
| const constrainedLine = constrainShapePreservingMove( |
Member
Author
There was a problem hiding this comment.
nit: Add a similar comment like above so this logic is consoludated once ray and vector are moved over.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Wires the Linear graph's
movePoint(endpoint) andmoveLine(whole-linegrab handle) actions into the existing WB Announcer pipeline.
What this PR does:
case "linear"indoMovePointInFigurenow emitsstateAnnouncement: {type: "move-linear-point", pointIndex, x, y}when anendpoint moves.
case "linear"indoMoveLineemitsstateAnnouncement: {type: "move-linear-line", coords}when the wholeline is dragged via the grab handle. Both
case "linear"blocks are splitout from the shared
case "ray"/case "vector"blocks so ray and vector(not yet migrated) are intentionally untouched.
MoveLinearPointAnnouncementandMoveLinearLineAnnouncementto
InteractiveGraphStateAnnouncement.getAnnouncementTexthandles"move-linear-point"with the generic
srPointAtCoordinatesstring ("Point N at X comma Y.",matching the endpoints'
aria-label) and"move-linear-line"withsrLinearGrabHandle("Line going through point X1 comma Y1 and point X2comma Y2.").
ariaLiveoverride prop toMovableLine. Itdefaults to
undefined, preserving the internalaria-livestate machinefor the other graphs that still share
MovableLine(ray, segment,linear-system).
linear.tsxpassesariaLive="off"so the WB Announceris the only source of move announcements for the Linear graph.
which tracks removing
aria-livefromuseControlPointandMovableLineonce every line graph's reducer is wired to the announcer.
movePointandmoveLineon linear, addstwo
screenreader-texttests (move-linear-point+move-linear-line),and removes the now-obsolete "Should update the aria-live when X is moved"
test from
linear.test.tsx.Issue: LEMS-4198
Test plan:
Automated
pnpm tsc— passespnpm lint packages/perseus— passespnpm jest packages/perseus/src/widgets/interactive-graphs— passesManual (reviewer)
pnpm storybook). Turn on VoiceOver / NVDA (or use the Storybook a11y addon's live-region inspector).aria-label, unchanged).aria-liveand the WB Announcer would have fired.move-linear-lineannouncement, and you should hear it only once.