Skip to content

[Component Audit] Chart: strengthen accessibility and audit coverage - #6247

Merged
cixzhang merged 1 commit into
mainfrom
night-watch-component-audit/Chart/2026-09-11
Sep 11, 2026
Merged

cixzhang merged 1 commit into
mainfrom
night-watch-component-audit/Chart/2026-09-11

Conversation

@cixzhang

@cixzhang cixzhang commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

@astryxdesign/charts users could not pass standard DOM props or refs to Chart, and screen-reader fallback text was fixed English. The component also had no canonical contract and almost no consumer documentation, which made its public states impossible to audit completely.

This Night Watch audit uses Component Audit Rubric v1.16.2.

  • Repository base: 41ab6db2a5d193739759ad2ba14b6be21509a2d7
  • Audited head: 29efe4a12e97f9b7f7fb85a546ced3ff28cd2f7c
  • Component contract at base: absent
  • Component contract at head: packages/charts/src/Chart.spec.md at 29efe4a12e97f9b7f7fb85a546ced3ff28cd2f7c (authority: draft)
  • Open-PR overlap scan: no open PR touched packages/charts/src/* or the Chart story/doc surfaces before remediation.
  • Review status: ready for human review; not land-ready because four retained BLOCKs and the known pr-rtl coverage failure remain.

What changed

  • Added the required observational Chart contract and complete consumer docs.
  • Restored BaseProps, root DOM/ref forwarding, merged styling, logical token spacing, localized chart/legend accessibility text, and shared locale-aware list formatting.
  • Added one reusable Chart-root Storybook fixture and one non-showcase example block; updated the additive ShadCN route lock.
  • Added focused regression tests with recorded red → green evidence for root passthrough/ref and localized chart/legend labels.

Score

Score Grade Open BLOCKs
Before 58.1 F 11
After 78.0 C 4

Fixing the four retained BLOCK findings and changing nothing else projects 90.0 / A.

Section Weight Before After Result
Accessibility 16 2.5 2.5 Large-data and coarse-pointer tooltip paths remain unresolved.
Theming 14 3.0 5.0 Inline style merge and raw physical spacing fixed.
Public API 14 2.0 2.5 Root passthrough/ref fixed; two breaking API findings retained.
Behavior 12 4.0 4.5 All established root states observed.
Design — objective 6 4.0 5.0 Logical token spacing and non-scroll clipping fixed.
Design — rendered 4 3.0 4.0 Full light/dark matrix captured; two representations remain Needs Review.
Testing 8 3.0 4.0 Focused regressions and package-specific axe added; shared RTL routing gap remains.
Code health 8 3.0 4.0 Root merge is clear; observer and series-mutation debt retained.
Docs/Storybook 8 2.0 4.5 Full docs, contract, story, showcase, and example coverage.
i18n/RTL 5 2.5 4.0 Generated names/captions localized; shared RTL filter gap remains.
Responsive/touch 5 4.0 5.0 Narrow, long-text, RTL, and coarse-pointer states verified.

Fixed findings and authority

  • T12; P1/P2/P15 — standard root DOM props, styles, events, and React 19 ref now reach the root container (architecture:public-component-api/INV5–INV8; API Conventions “Capture and Forward ...rest” and “ref as a Prop”).
  • I2/I6/I21 — generated image names, series lists, data-table captions, and the built-in legend label now follow InternationalizationProvider (@astryx.* catalog + provider locale).
  • I8/D1/R7 — the title gap uses logical token spacing, and the side-legend plot uses overflow: clip rather than a scroll container.
  • X2/X3/X4/X5b/X7/X10/X12/X14/X16 — consumer docs, accessibility profile, anatomy, public prop/default coverage, bare-fence example, reusable Storybook fixture, and a non-showcase example block are present.

Retained findings

BLOCK

  • A1 / WCAG 1.1.1 — above the 100-cell hidden-table cutoff, title and subtitle remain optional, so a screen-reader user can receive only a generic chart name with no guaranteed equivalent summary or data path. The correct public accessibility contract needs owner judgment.
  • A8 — on a coarse pointer, tapping the plot leaves the tooltip hidden. Sighted touch users have no discoverable path to the precise values exposed on hover; the correct persistent/tap interaction needs owner judgment.
  • P7 — ChartMargin.left/right and the nested tooltip placement values left/right are physical public API. A logical-name migration is breaking and remains out of this audit.
  • AST-002/FR18 — exported SeriesDef exposes _uid, _isTopOfStack, and _resolvedColor, and Chart annotates caller-owned definitions during render. Removing those reachable internals or changing the single-use contract needs an explicit API/compatibility decision.

FIX

  • C7 — each Chart still owns a ResizeObserver; moving to the shared observer requires coordinated test-fixture changes beyond this bounded pass.
  • I17/V11 — the shared RTL command routes --filter Chart to lab/Chart and excludes charts-* stories. This PR therefore uses package-specific Chromium RTL evidence rather than claiming the stock report covers Charts.
  • A14 (advisory, ChartSwatch owner) — forced-colors rendering removes composed legend swatches, weakening the visual series-to-label association.
  • D11/B14 (advisory, ChartTooltip owner) — the composed tooltip uses a global z-index: 9999 rather than the current layer runtime.
  • V3 — the public root pointer stream is proven by browser hover evidence, but lacks a stable root-level integration test.
  • D13 (hover/tooltip) — the translucent plot-column indicator and popover-surface tooltip do not map exactly to the current hovered/temporal representation catalogue; ChartTooltip ownership is needed before changing them.
  • D13 (empty) — the finite empty coordinate frame is stable, but no current chart-specific empty representation decides whether it should remain or defer to an empty-state treatment.

NIT

  • X19 — the generated component playground cannot synthesize executable SeriesDef factories from plain defaults; the checked Storybook fixture is the working interactive surface.

Needs Review

  • The draft component contract needs exact-head owner review before it can become current.
  • The four retained BLOCKs above require accessibility/API decisions and are intentionally not remediated here.
  • The hover/tooltip and empty-state visual representations need their owning design decisions.
  • Forced-colors swatches, global tooltip layering, and the shared RTL harness belong to their owning shared surfaces.
  • The dark-theme purple auto-palette relationship measures 2.33:1; public issue [Bug] Widespread WCAG 2.1 AA colour contrast failures across Design System #4652 owns that token-layer gap, so it is reported but not scored against Chart.
FR5 closed public-surface inventory (25/25 rows accounted for)
# Surface/state Source and evidence Result
1 Chart / ChartProps export package barrel, typecheck, root regression test Mapped; BaseProps/ref fixed.
2 data, xKey, series Chart/marks tests, README, root story Mapped.
3 zero-width placeholder → measured SVG measurement test, browser geometry Mapped; C7 observer debt retained.
4 default/invalid height source, placeholder geometry test, height control Mapped.
5 partial margin source, geometry test Mapped; P7 retained.
6 yBaseline values layout implementation and mark stories/tests Mapped.
7 explicit yDomain layout implementation, streaming story Mapped; root-level test gap noted.
8 numeric xDomain; categorical ignore layout implementation, streaming story Mapped.
9 grid slot render order, ChartGrid tests/stories Mapped.
10 axes slot render order, ChartAxis tests/stories Mapped.
11 legend off/true/config root and legend tests; all-position receipts Mapped.
12 tooltip off/true/config root/tooltip tests; hover and coarse-pointer probes Mapped; A8 tap-path BLOCK retained.
13 interactions slot render order; interactive story Mapped; stable root integration test gap noted.
14 children SVG escape hatch render order and consumer docs Mapped.
15 supplied title accessible-name test and light/dark receipts Mapped.
16 supplied subtitle description test and light/dark receipts Mapped.
17 generated accessible name localization regression test and receipt Mapped and fixed.
18 small-data hidden table semantic table tests and package axe Mapped.
19 empty data finite fallback scales and empty-state receipts Mapped; representation remains Needs Review.
20 >100-cell data cutoff test and large-data receipts Mapped; A1 retained.
21 clipping and paint order clipped-group/event-layer tests, visual matrix Mapped.
22 pointer move/leave dispatch implementation, tooltip tests, hover receipts Mapped; V3 gap noted.
23 auto palette / utility exclusion palette test and auto-palette receipts Mapped; SeriesDef mutation retained.
24 legend top/bottom/start/end root fixture, legend tests, all-position receipts Mapped.
25 RTL / 320 px / coarse pointer canonical sensor receipts and package-specific probes Mapped; stock RTL routing gap and A8 tap failure retained.

Evidence and checks

  • Exact-head evidence index: screenshots, sanitized canonical receipts, scorecard, FR5 inventory, contrast/state matrices, axe, RTL, and FR10.
  • Before/after pixel report: 24 matched pairs, 0 changed pairs, 0 changed pixels.
  • Package-specific axe: 34 stories, 0 violations, 0 page errors. The stock --components Chart gate also passed.
  • Package-specific RTL: logical start/end passed in LTR and RTL with no horizontal overflow. The stock report records its current lab/Chart routing gap.
  • Rendered contrast: component-owned pairs pass; the known dark-purple palette-token gap is recorded separately and remains unscored under [Bug] Widespread WCAG 2.1 AA colour contrast failures across Design System #4652.
  • Focused Charts tests: 92 passed on exact head.
  • Charts package/docs and Storybook typechecks: passed.
  • Relevant package and Storybook builds: passed.
  • Docsite generation and tests: 496 passed.
  • Knowledge, sync, changeset, locale-catalog, use-client, package-boundary, and export validation: passed.
  • Strict lint: passed with 0 errors (84 existing warnings outside this change).
  • Repository-wide tests: not rerun locally; exact-head Linux CI is terminal. All checks passed except pr-rtl, which reproduced the retained I17/V11 coverage gap by measuring lab/chart and reporting one uncovered component.

Chart before and exact-head contact sheet

FR10 eligibility (v1)

Verdict: manual-review-only / ineligible for unattended merge. Full v1 exact-head report

Reasons:

  1. spec:AST-029 is authority: current but still phase: accepted; FR11 activation is not shipped.
  2. The new observational component contract remains authority: draft and has no exact-head owner approval yet.
  3. Four pre-existing BLOCK findings remain.
  4. Independent review is pending.
  5. Exact-head GitHub CI is terminal with pr-rtl failed by the retained I17/V11 coverage gap; all other checks passed.
  6. The trusted audit-eligibility check is not activated.

Do not auto-merge this PR.

@vercel

vercel Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 11, 2026 11:04am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 11, 2026
@astracat-bot

astracat-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Sep 11, 2026, 11:14 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 11, 2026
github-actions Bot added a commit that referenced this pull request Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Chart (@astryxdesign/charts) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 399 -
Complexity N/A Very High (50) -
ChartLegend (@astryxdesign/charts)
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 54 -
Complexity N/A Low (5) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/charts N/A 922B 436B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

cixzhang added a commit to cixzhang/astryx that referenced this pull request Sep 11, 2026
@cixzhang
cixzhang merged commit 2247368 into main Sep 11, 2026
26 of 27 checks passed
@cixzhang
cixzhang deleted the night-watch-component-audit/Chart/2026-09-11 branch September 11, 2026 16:19
@cixzhang cixzhang changed the title Harden Chart contracts, accessibility, and audit coverage [Component Audit] Chart: strengthen accessibility and audit coverage Sep 11, 2026

This branch was successfully deployed

1 active deployment
Preview — 29efe4a1 Deployed Sep 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant