feat(a11y): fallback <desc> generators for core charts (#119)#129
Merged
Conversation
Surface already wires role/title/desc/aria-label; the gap was that charts only emitted <desc> when the consumer passed `description`. Adds per-chart-type fallback generators so screen-reader users get a useful one-liner from the data when no description is provided. - new src/core/a11yDescribe.ts: describeBars / describeSeries / describePie / describeScatter - BarChart, LineChart, AreaChart, PieChart, ScatterPlot fall back to the generator when `description` is omitted - new src/components/a11y.test.ts covers role=img, fallback <desc>, explicit-description precedence, and aria-label falling back to title - a11yDescribe.test.ts covers each generator (singular nouns, empty data, multi-series, decimal formatting) Bundle stays at 48 KB gzipped (budget 75 KB). All 395 existing tests pass plus 17 new. Follow-up tracked in #119: dataTable forwarding through diagrams (custom DataTableModel per diagram type).
This was referenced May 28, 2026
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
src/core/a11yDescribe.tswithdescribeBars/describeSeries/describePie/describeScatter— short, deterministic, dependency-free sentences summarising chart shape.descriptionis omitted, so the<desc>tag always carries something useful for screen readers.src/components/a11y.test.tscoversrole="img", fallback<desc>, explicit-description precedence, andaria-labelfalling back totitle.a11yDescribe.test.tscovers each generator (singular nouns, empty data, multi-series, decimal trimming).Why this is narrower than the issue
The original #119 spec assumed a11y plumbing was missing. Audit showed
Surfacealready wiresrole/<title>/<desc>/aria-label/ SR-only data table, and 14 of 15 chart components forward those props. The real remaining gap was: no fallback<desc>when consumers don't passdescription, and no a11y test coverage. This PR closes both.I narrowed the issue body before this PR;
dataTableforwarding through diagrams (customDataTableModelper diagram type) is now the follow-up tracked there.Verification
npm run typecheckcleannpm test— 395 existing tests pass + 17 newnpm run build && npm run check:bundle— browser entry 48 KB gzipped (budget 75 KB), no font leakTest plan
Closes the narrowed scope of #119.