Repository navigation
Description
Summary
The accessibility gate (pnpm test:a11y) sometimes audits a story before the story has finished rendering. settled() in scripts/check-a11y.mjs waits for the first DOM mutation and then 250 ms of quiet. A story that renders a shell first and its content after a longer pause looks settled too early. axe, the tap probe and the keyboard walk then measure a partial page. The gate fails at random on a required check, or passes having read less of the page.
Approach
- Evidence: on PR feat(dates): every date and time through one Intl formatter, in the visitor's own format #509,
views--event-·-sticky-registerwas audited with 2 tab stops in one full run and 12 in the next, on the same build. The walk then landed on "Copy address", a button the audit never stamped. Across back-to-back runs the gate also measured 696 and then 706 controls on an unchanged tree. - Masked, not fixed: before PR feat(dates): every date and time through one Intl formatter, in the visitor's own format #509, an unstamped stop read as order 0 (
Number(null)) and failedtab-order("Tab went backwards to …"). That PR makes an unstamped stop abstain. The CI failure no longer shows, but the audit still reads a partial page. - Fix options: have
settled()wait for a readiness signal the story gives, rather than a quiet period alone. For example, wait until no[aria-busy="true"]element or skeleton is left and no lazy chunk is still loading. Or lengthen the quiet window for the stories that need it, and record the measured render times besideQUIET_MS. - A tripwire: report a story whose stamped stop count changes between two audits of the same page (audit, settle again, audit). That makes a partial read visible instead of silent.
Acceptance criteria
-
views--event-·-sticky-registerreports its full set of tab stops on every run. - Across repeated full runs on one unchanged build, the gate measures the same number of controls each time.
- A story audited before it finished rendering is reported, not passed or failed silently.
Verification checklist
- Run
pnpm ladle:build, thenfor i in 1 2 3 4 5; do node scripts/check-a11y.mjs | grep 'controls measured'; done: the count is identical on all five runs. - Log the sticky-register walk under the full run (as in PR feat(dates): every date and time through one Intl formatter, in the visitor's own format #509's debugging): the walk shows 12 stops every time.
-
pnpm test:run scripts/check-a11y.test.tspasses.
Notes
Found while getting PR #509 green. That PR also fixed a second bug in the walk: a roving-tabindex group made the walk wrap round to the first stop.
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
Medium
Hold Until
None yet
Projects
- StatusShow more project fieldsDone
Activity
fix(a11y-gate): audit a story only once it has finished rendering (#523)