feat(a11y): compiler-generated chart descriptions + ECharts aria/decal#62
Open
zl190 wants to merge 1 commit into
Open
feat(a11y): compiler-generated chart descriptions + ECharts aria/decal#62zl190 wants to merge 1 commit into
zl190 wants to merge 1 commit into
Conversation
Generate a short accessible description from the semantic layer at compile time (chart type, measure with unit, dimension, series, category/series counts, value range — structural and statistical only, no interpretive claims) and emit it on every backend: Vega-Lite top-level description, ECharts aria.label via the built-in aria module (enabled by default), and _a11y.description metadata for Chart.js hosts to wire onto the canvas aria-label. field_display_names is respected. ECharts decal patterns (color-vision-deficiency support) are available behind options.a11yDecal — opt-in because they visibly change the chart, while the description metadata is invisible and always on. - core/a11y-description.ts: deterministic description builder - AssembleOptions.a11yDecal knob (ECharts only) - tests: 11 cases (copy exactness, grouped series, display names, determinism, per-backend surfaces, decal gating, JSON purity); no existing test expectations changed - docs/accessibility.md + api-reference link (includes the Chart.js wiring note and a Chartability coverage statement) Refs microsoft#48 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Refs #48. The compiled output of all three backends currently carries no accessibility surface — probed directly: the VL spec has no
description, the ECharts option has noaria, and the Chart.js config has no attachment point. Since Flint sits at the compile step, one generator covers all three backends. This PR adds that baseline.Implementation
core/a11y-description.ts: a deterministic description generator built from what the pipeline already knows — chart type, encoded fields with semantic types and units, and cheap statistics (category count, series count, value range). Structural + statistical only; no trend interpretation. Generated copy looks like:"Bar Chart of revenue (USD) by region. 3 categories. Range 145–168.""Line Chart of revenue by month, grouped by team. 2 series. Range 214–217.""Scatter Plot."— when a statistic can't be computed it is left out.description; EChartsaria: { enabled: true, label: { description } }; Chart.js has no native slot, so the config carries_a11y.description(matching the existing_warnings/_pivotconfig metadata) with a two-line wiring note in the docs for putting it on the canvasaria-label.options.a11yDecal, flat naming matchingaddTooltips.docs/accessibility.md: what is injected, the knob, the Chart.js wiring, and a Chartability coverage note stating what this baseline addresses and what it doesn't.Three decisions here are policy calls, each a one-line flip if you'd prefer them different: default-on for the invisible metadata, opt-in for decal, and stopping the copy at structural + statistical.
Verification
tests/a11y-baseline.test.ts— 11 cases: generator output across semantic combos (incl.unit/intrinsicDomainannotations), VLdescriptionpresent, ECharts aria on by default, decal only when opted in, Chart.js attachment, JSON purity unaffectedECharts decal off vs on (the only visual change, and only when opted in):
🤖 Generated with Claude Code