Repository navigation
test(a11y): Slider contract and binding - #7483
Conversation
SLIDER_PATTERN encodes the APG Slider parts component:Slider AR1 adopts per thumb: role and name, now/min/max, value text, orientation, arrow steps (inline arrows following the track under RTL), Page keys (advisory, APG-optional), Home/End to the bounds, and an unavailable thumb keeping its value. Fixtures carry a small script implementing the model so the Chromium self-test proves every mutation; the harness gains Home/End/PageUp/PageDown. The Slider binding has six states; two exact known failures record the shipped gaps the record names (RTL arrows not mirrored; End one step short when the step does not divide the range), each fixed by its own patch. Stories through the shared renderer, a CI step, and the README row. Test-only.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsSlider (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression44 of 448 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 24 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
… by 30 for the step-3 fixture; binding spec titles name Slider
…still loads the helper from the base
There was a problem hiding this comment.
This review is on hold for a maintainer decision: the new contract enforces Slider's arrow and Home/End keys, the right-to-left arrow direction, and End reaching max as required, but no current Slider record adopts those behaviors yet. Approval needs a maintainer to land the component:Slider AR1/DEC-2 record (#7463) with those claims as written, or to keep those expectations advisory under AST-020 FR9 until it does. Separately, please switch the new “Run Slider accessibility contract” CI step to the base-loaded pr-scope-touches.sh helper the other contract steps use: its two-dot git diff "$BASE_SHA" HEAD will list these new files on every component branch cut before this merges, so pr-a11y would fail there with “No tests found”.
[Automated review]
| if git fetch --quiet --depth=1 origin "$BASE_SHA"; then | ||
| if git diff --name-only "$BASE_SHA" HEAD \ | ||
| | grep -qE '^(internal/a11y-spec/src/patterns/slider|internal/a11y-spec/src/harness|packages/core/src/Slider/|apps/storybook/stories/SliderA11y)'; then | ||
| should_run=true | ||
| fi | ||
| else | ||
| should_run=true | ||
| fi |
There was a problem hiding this comment.
This two-dot diff is what pr-scope-touches.sh replaced in the other contract steps. pr-a11y checks out the PR head, so once this merges, a component branch cut earlier sees the Slider contract files as changed, sets should_run=true, and Playwright exits 1 with “No tests found” because those specs are not in that checkout. Loading the helper from the base, exactly as the Landmark and Link steps do (same pattern), avoids it.
| // Every consumer loads the helper from the base; new contract steps add | ||
| // consumers, so the count is a floor, not an exact tally. | ||
| expect(uses.length).toBeGreaterThanOrEqual(4); |
There was a problem hiding this comment.
At this head the Slider step does not load the helper, so the workflow still has exactly four consumers, as on main. The floor becomes meaningful once the Slider step uses the helper (or the exact count can move to 5).
| }, | ||
| evidenceLayer: 'real-browser', | ||
| alsoNeeds: ['dom'], | ||
| enforcement: 'required', |
There was a problem hiding this comment.
required here (and on slider.keys.home-end) comes from listing WCAG 2.1.1 first, but the recorded RTL and step-3 failures leave the slider keyboard-operable, so what fails is the APG/AR1 mechanic. Under AST-020 FR9 that needs a current adopting record, and component:Slider on main does not adopt keyboard behavior yet; this waits on the AR1/DEC-2 record landing as written, or ships advisory until then.
There was a problem hiding this comment.
Changes requested: now that component:Slider AR1 is current and adopts Page Up/Page Down (ten steps), slider.keys.page should be required rather than advisory under AST-020 FR9 — its own advisoryBecause says as much, and as written a Page regression in Slider would only be reported. Slider already passes that row in every operable state, so the flip needs no new known-failure record; please also update the expectation table in the description and rebase onto main, where the CI workflow and the a11y-spec README now conflict with the Accordion contract. With the Slider record landed and the CI step scoped from the base, the rest of the contract is in good shape.
[Automated review]
| }, | ||
| evidenceLayer: 'real-browser', | ||
| alsoNeeds: ['dom'], | ||
| enforcement: 'advisory', |
There was a problem hiding this comment.
component:Slider AR1 is now current and adopts Page keys (“PageUp and PageDown step by ten steps”), so under AST-020 FR9 this row should be required — the advisoryBecause text below anticipates exactly that. While it stays advisory, blockingResults only reports a Page failure, so a regression in Slider's Page keys would pass pr-a11y. Slider passes this row in all five operable binding states, so flipping it needs no new known-failure record; the description's expectation table should change with it.
| id: 'slider.keys.arrows-step', | ||
| outcome: | ||
| "The inline-forward arrow and Up raise the value by one step, the inline-back arrow and Down lower it, and on a right-to-left track the horizontal arrows follow the track's direction.", | ||
| sources: [WCAG_2_1_1, APG_ARROWS, APG_REVERSED], |
There was a problem hiding this comment.
Non-blocking: the RTL half of this outcome is normative because of component:Slider AR1/DEC-2, not APG_REVERSED, which only says reversing “could create a more intuitive experience”. Citing AR1 as an astryx source with a pinned public URL (as modal-dialog.ts does for component:Dialog) would make the record that gates this row, and the Page and Home/End rows, traceable from the failure output (AST-020 FR4).
… (current) adopts ten-step Page keys
# Conflicts: # .github/workflows/ci.yml # internal/a11y-spec/README.md
There was a problem hiding this comment.
Changes requested: the Slider contract and binding match the now-current component:Slider AR1 and CI is green, but slider.thumb.value-properties cannot detect a thumb that loses aria-valuemin whenever its minimum is 0 (every bound state), because Number(null) is 0 and the “absent” guard never fires. Please read aria-valuemin and aria-valuemax the way valueNow reads aria-valuenow, so an absent bound fails, and add a violating-no-valuemin fixture to the mutation map; today, removing the attribute from Slider leaves the new binding green while Slider.test.tsx fails. While there, consider citing AR1 as the source of the RTL, Page and End rows, and refresh the description's evidence and source-line notes, which still mention two known failures and no RTL swap.
[Automated review]
| const min = Number(await subject.attribute('aria-valuemin')); | ||
| const max = Number(await subject.attribute('aria-valuemax')); | ||
| if (!Number.isFinite(min) || !Number.isFinite(max)) { | ||
| throw new Error( | ||
| 'aria-valuemin or aria-valuemax is absent or not a number', | ||
| ); |
There was a problem hiding this comment.
Number(null) is 0, so an absent aria-valuemin or aria-valuemax never reaches this guard: a thumb without aria-valuemin passes whenever the state's minimum is 0 (all six Slider states), and an absent maximum is reported as 0 instead of absent. Removing aria-valuemin from Slider leaves the binding green while Slider.test.tsx fails. Reading the bounds the way valueNow reads aria-valuenow closes it:
async function bound(
subject: Subject,
name: 'aria-valuemin' | 'aria-valuemax',
): Promise<number> {
const raw = await subject.attribute(name);
const parsed = raw == null || raw.trim() === '' ? Number.NaN : Number(raw);
if (!Number.isFinite(parsed)) {
throw new Error(`${name} is ${raw ?? 'absent'}, not a number`);
}
return parsed;
}Please also add a violating-no-valuemin fixture (slider({omit: ['aria-valuemin']})) under slider.thumb.value-properties in SLIDER_MUTATIONS (AST-020 FR11).
…emin/aria-valuemax; new violating-no-valuemin fixture; RTL, Page and End rows also cite component:Slider AR1
There was a problem hiding this comment.
This is ready for maintainer approval: the Slider contract and binding match the current component:Slider AR1 record, the value-properties row now fails when a thumb drops aria-valuemin or aria-valuemax (removing aria-valuemin from Slider turns all six binding states red), and CI is green on this head. Two optional touch-ups: quote AR1 verbatim in SLIDER_AR1 (it drops the left-to-right clause, and the value-text and reversed-arrow APG quotes drop their "e.g." examples), and refresh the description's Slider.tsx line numbers (thumb ARIA L950–963, keys L830–866). Whichever of this PR and #7484 merges second needs to remove the step-three known-failure entry in that same change.
[Automated review]
| clause: 'AR1', | ||
| url: 'https://github.com/facebook/astryx/blob/250fd9ac197381ec06900279efc31cbb03544ca9/packages/core/src/Slider/Slider.spec.md#L120-L133', | ||
| requirement: | ||
| "On a horizontal track the horizontal arrows follow the track's direction — under RTL ArrowLeft increases and ArrowRight decreases; PageUp and PageDown step by ten steps; Home moves to `min` and End to `max`.", |
There was a problem hiding this comment.
Non-blocking: this isn't a verbatim quote of AR1. The record reads: "on a horizontal track the horizontal arrows follow the track's direction — ArrowRight increases and ArrowLeft decreases under LTR, and under RTL ArrowLeft increases and ArrowRight decreases; PageUp and PageDown step by ten steps; Home moves to min and End to max." AstryxRecord.requirement asks for the requirement "quoted exactly", so paste the full sentence (lower-case "on") or an exact sub-span. APG_VALUETEXT (L54) and APG_REVERSED (L86) similarly drop the published pattern's "e.g." examples.
What this proves
component:SliderAR1 (the Slider adoption recorded in #7463 underspec:AST-020FR15) now has an executable contract and a binding. A keyboard or screen-reader user on a Slider thumb gets: a named slider that states its value and bounds (and a formatted value when one is set), says when it is vertical, steps with the arrows — the horizontal arrows following the track's direction on a right-to-left page — pages with Page Up/Down, jumps to the bounds with Home/End, and, when disabled but still focusable for its message, never changes under the keyboard.Test-only: no runtime, docs, or Changeset. Enforcement follows
spec:AST-020FR9:component:SliderAR1 is current onmain(#7463) and adopts ten-step Page keys, so every expectation — Page Up/Down included — isrequired.Expectations (AST-020 FR13)
slider.thumb.role-and-nameslider.thumb.value-propertiesslider.thumb.value-textslider.thumb.orientationslider.keys.arrows-stepslider.keys.pageslider.keys.home-endslider.thumb.unavailable-keeps-valueExemptions:
1.1.1-non-text-content→ the binding component;1.3.1-info-and-relationships→ the binding component and caller content;1.3.2-meaningful-sequence→ the binding component and composing page;1.3.5-identify-input-purpose→ not applicable;1.4.1-use-of-color→ the binding component and theme;1.4.3-contrast-minimum→ the binding component and theme;1.4.11-non-text-contrast→ the binding component and theme;2.1.1-keyboard→ the composing page (remainder only);2.1.2-no-keyboard-trap→ the binding component and composing page;2.4.2-page-titled→ the page;2.4.3-focus-order→ the composing page;2.4.4-link-purpose→ not applicable;2.4.6-headings-and-labels→ the binding component and caller content (remainder only);2.4.7-focus-visible→ the binding component and theme;2.4.11-focus-not-obscured→ the composing page;2.5.2-pointer-cancellation→ the binding component;2.5.3-label-in-name→ the binding component;2.5.8-target-size→ the binding component and theme;3.1.1-language-of-page→ the page;3.2.2-on-input→ the caller and composing page;3.2.4-consistent-identification→ the composing page;3.3.1-error-identification→ the binding component;3.3.2-labels-or-instructions→ the binding component and caller content;4.1.2-name-role-value→ the binding component (remainder only);4.1.3-status-messages→ the caller and the assistive-technology verification record, spec:AST-009;apg-interaction→ the binding component's record (remainder only);forced-colors→ the binding component and theme;reduced-motion→ the binding component and theme;at-facing-strings→ the binding component and caller contentKnown failures (exact records, reconciled in both lanes)
Slider/step-threeslider.keys.home-endEnd left aria-valuenow at 99, not 100component:SliderAR1 names this gap (End moves tomax); its own endpoint fix follows.Shape
internal/a11y-spec/src/patterns/slider.ts—SLIDER_PATTERN, 8 expectations, allrequirednow that AR1 is current with WCAG and APG sources (APG Slider wording verified against the published pattern on 2026-10-13); every other checklist dimension exempted to a named owner.slider.fixtures.ts— an HTML thumb whose<script>implements the keyboard model (Chromium runs it; the DOM lane only reads attributes); every expectation has at least one violating twin (SLIDER_MUTATIONS).slider.jsdom.test.ts(33 cases) andslider.chromium.spec.ts.internal/a11y-spec/src/harness.ts+harness/chromium.ts—KeygainsHome,End,PageUp,PageDown(additive).packages/core/src/Slider/__tests__/Slider.a11y.{states,renders,known-failures,test}.tsxandSlider.a11y.chromium.spec.ts— six states: horizontal, vertical, horizontal RTL, formatted value, disabled with message (focusable, inoperable), step 3.apps/storybook/stories/SliderA11y.stories.tsx— oneno-visualstory per state, rendered throughrenderSliderStateso the lanes cannot drift..github/workflows/ci.yml— "Run Slider accessibility contract" step; runs when Slider, the harness, the stories, or the contract change.pr-scope-touches.shfrom the base.Source lines behind the binding facts
role="slider",tabIndex(focusable when disabled with a message),aria-valuemin/max/now/valuetext/orientation/disabled,aria-labelledby(Slider.tsx L936–955); keys: ArrowRight/Up +step, ArrowLeft/Down −step, Page ±10 steps, Home/End to min/max, then snap-then-clamp for arrows and Page keys (L828–857,snapToStepL396–401 — the source of the step-3 End gap until #7484); the RTL swap of the horizontal arrows is onmain(#7461).Ownership exclusions
SLIDER_EXCLUSIONS: range-thumb separation and group semantics (binding's own tests); pointer drag model, track clicks and the value tooltip.Evidence
violating-no-valueminfixture joins the map;value-propertiesnow reads every bound the way it readsaria-valuenow, so an absentaria-valueminfails even at min 0); tsc (core, a11y-spec, storybook), eslint, Prettier, visual-workflow-owner clean.main.