Repository navigation
fix(lab): ThreeDChart accessible name, pausable rotation, keyboard camera - #4381
Merged
Merged
Conversation
bhamodi
requested review from
cixzhang,
ejhammond and
imdreamrunner
as code owners
July 26, 2026 05:04
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
approved these changes
Jul 30, 2026
cixzhang
enabled auto-merge (squash)
July 30, 2026 22:09
This branch was successfully deployed
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
Fixes three accessibility issues in
ThreeDChart(packages/lab/src/ThreeD/ThreeDChart.tsx) found by a11y scan #3:<svg>had no role, no accessible name, and no text alternative; screen readers announced nothing meaningful for the entire chart.autoRotateran a continuous rAF loop that never stopped and ignoredprefers-reduced-motion.Companion to the charts a11y PR (Chart/Radial/Sankey); this PR owns
ThreeDChart.tsxexclusively, and the newlabelprop matches the naming and mechanism (role="img"+aria-label, derived default) used there.Changes
<svg>now hasrole="img"andaria-labelfrom a new optionallabelprop, defaulting to a description derived from the data keys ("3D chart of {yKey} by {xKey} and {zKey}") — consistent with the Chart/Radial/Sankey defaults.prefers-reduced-motion: reduce, via the SSR-safeuseMediaQueryhook from@astryxdesign/core/hooks(subscribes tomatchMediachange events, so it reacts to live OS setting changes).tabIndex=0) whenever it auto-rotates so keyboard users can pause it too.autoRotateis opt-in (default off) and decorative. With hover/focus pause giving users a way to stop the movement, reduced-motion respect, and the prop itself as the documented off switch (JSDoc updated), this satisfies 2.2.2's requirement for a mechanism to pause/stop non-essential moving content.interactive): ArrowLeft/ArrowRight rotate yaw, ArrowUp/ArrowDown rotate pitch, 10° per press, with the same[-89, 89]elevation clamp as pointer drag. Arrow keys callpreventDefault()so the page does not scroll while the chart is focused; other keys are left alone. A static chart (no interaction, no rotation) gets no tab stop.Test plan
New colocated suite
packages/lab/src/ThreeD/ThreeDChart.test.tsx(15 tests), using the same ResizeObserver-driving pattern asSankeyChart.test.tsxplus a manual rAF queue and a camera probe child (use3D()) to observe angles:labelprop; static chart has no tabindexmatchMedia) prevents the rAF loop from ever being scheduledcancelAnimationFramespy fires, the queue empties, azimuth stops advancing, and rotation resumes on mouse-out/blurkeydownpreventDefaultasserted viafireEvent's return value (arrows prevented, other keys not); arrows ignored when notinteractiveCommands (all pass):
node_modules/.bin/prettier --checkon changed files — cleannode_modules/.bin/eslinton changed files — cleannode_modules/.bin/tsc --project packages/lab/tsconfig.json --noEmit— cleannode_modules/.bin/vitest run packages/lab/src/ThreeD --reporter=dot— 2 files, 51/51 passednode_modules/.bin/vitest run packages/lab --reporter=dot— 20 files, 268/268 passedPre-fix failure confirmed: 14 of the 15 new tests fail against the unmodified component (the only passing one is the baseline "rotates when autoRotate is set" behavior check).
jsdom limitations: no real rendering/frame timing, so the rotation tests drive a stubbed rAF queue rather than real frames; visual smoothness of rotation and actual OS-level reduced-motion behavior were not manually verified in a browser. Manual check if desired: enable "reduce motion" in OS settings and confirm an
autoRotatechart stays still; hover/focus it and confirm rotation pauses.Notes
@astryxdesign/labis private/canary-only and changeset-exempt (scripts/check-changesets.mjsrejects lab changesets; precedent in [RFC #3899] feat(lab): experimental Lexical rich-text editor (RichTextEditor + RichTextView) #3900), so this PR intentionally ships no changeset.