Repository navigation
ci: discover PR browser accessibility specs, so a new spec needs no workflow edit - #8367
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
|
There was a problem hiding this comment.
Changes requested: the discovery design keeps every job name, the typecheck coverage and the pull-request accessibility selection, but a few things need fixing first.
- Split the typecheck consolidation and the test-script wrappers into their own pull requests, and stage the
pr-a11ymigration or explain why its step deletions cannot be staged. - Restore axe coverage of the open state for component-audit pull requests: the remaining scoped audit passes no
--ready-selector, so DateInput, ContextMenuItem, DropdownMenuGroup, DropdownMenuDivider and DropdownMenuItem audits no longer scan their open dialog or menu. - Delete the committed
pr-a11y-evidence/selection.jsonand addpr-a11y-evidence/andpr-a11y-output/to.gitignore.
[Automated review]
| { | ||
| "head": null, |
There was a problem hiding this comment.
This is a local run of the new runner ("head": null, "scopeKnown": false, a component audit DateInput selection), and every pnpm test:a11y-contract:pr run rewrites it. Please delete it and add /pr-a11y-evidence/ and /pr-a11y-output/ to .gitignore.
| # head is routed by current policy; the specs themselves run at the head. | ||
| # Release checks run only the always-on specs here: every spec runs in | ||
| # a11y-contracts. | ||
| - name: Run browser accessibility specs |
There was a problem hiding this comment.
Component-audit PRs lose their focused axe passes with this change. The removed DateInput step held axe until [role="dialog"] on core-dateinput--open-calendar-audit, and the ContextMenuItem, DropdownMenuGroup, DropdownMenuDivider and DropdownMenuItem steps waited for [role="menu"]; the remaining Run accessibility audit step passes no --ready-selector, so those audits can scan the closed trigger. Could the scoped audit take each changed audited component's readiness (for example from a small map), and could the runner set ASTRYX_AUDIT_BASELINE_HEAD, which ChatTokenizedText.a11y.chromium.spec.ts still records?
| from your branch would run. Every spec writes its receipts under | ||
| `test-results/<name>/` and CI uploads them in one `pr-a11y-evidence-<sha>` |
There was a problem hiding this comment.
Eleven audit specs write top-level <name>-audit-evidence/ folders (for example DateInputAudit.a11y.chromium.spec.ts), which is why the upload also lists *-audit-evidence/; worth naming both locations here.
48b1383 to
c7cb592
Compare
There was a problem hiding this comment.
Changes requested: with the typecheck and script work split out and the open-state audit passes restored, discovery keeps every pull request's spec selection, but one regression remains. Every [Component Audit] <Name>: title now triggers an axe pass, and for a name with no owned Storybook route, such as DialogHeader, CheckboxIndicator or CommandPaletteEmpty, accessibility-audit.js exits with "No owned Storybook stories resolved", so those audit pull requests would fail pr-a11y. Please build the audit plan only for names that have an @pr-a11y audit line or an entry in .github/a11y-audit-axe.json, or skip names with no owned route with a notice, and add a test for an unconfigured title.
[Automated review]
| const [audited] = auditedComponents(title); | ||
| const auditConfigFile = '.github/a11y-audit-axe.json'; | ||
| const plan = audited | ||
| ? auditPlan(audited, readAuditConfig(root, auditConfigFile, policySha)) |
There was a problem hiding this comment.
Any [Component Audit] <Name>: title builds an axe plan here, so a name with no owned Storybook route (for example DialogHeader, CheckboxIndicator or CommandPaletteEmpty) reaches accessibility-audit.js, which exits 1 with "No owned Storybook stories resolved for: " and fails pr-a11y. On main only the 25 audits with their own step ran this pass. Could the plan be built only when the name appears in an @pr-a11y audit line or has an entry in .github/a11y-audit-axe.json, or skip a name with no owned route with a notice?
|
|
||
| function readComponents(root) { | ||
| const analysis = path.join(root, 'analysis.json'); | ||
| if (!fs.existsSync(analysis)) return []; |
There was a problem hiding this comment.
Locally there is no analysis.json, so the documented --dry-run leaves out every spec selected only through a component token (for example combobox.chromium.spec.ts for a Selector change). A notice that component scope was not evaluated would keep the dry-run accurate. Non-blocking.
There was a problem hiding this comment.
Changes requested: discovery keeps every pull request's spec selection and the earlier audit-title regression is fixed, but the new local entrypoint can rewrite a contributor's clone. changedSinceMergeBase fetches with --depth=200 whenever a base is given, so pnpm test:a11y-contract:pr main --dry-run from a pushed branch turns a full clone into a 200-commit shallow one; please fetch and deepen only when git rev-parse --is-shallow-repository is true. Please also make the bare pnpm test:a11y-contract:pr line in CONTRIBUTING pass origin/main --dry-run, since without a base it runs every scoped spec, and consider keeping the Markdown parity evidence upload on release checks, which no job uploads after this change.
[Automated review]
| const fetch = extra => | ||
| git(['fetch', '--quiet', '--no-tags', ...extra, 'origin', base, head]); | ||
| // A local run may name a ref that is already present (origin/main). | ||
| try { | ||
| fetch(['--depth=200']); | ||
| } catch { | ||
| git(['rev-parse', '--verify', `${base}^{commit}`]); | ||
| } |
There was a problem hiding this comment.
In a complete local clone this fetch truncates history: when the remote serves both commits (for example pnpm test:a11y-contract:pr main --dry-run from a pushed branch), git fetch --depth=200 turns the clone shallow. A 261-commit clone on a pushed branch dropped to 201 commits after changedSinceMergeBase('main'); origin/main only works because the remote does not serve that ref. Could the fetch and the deepening run only when git rev-parse --is-shallow-repository is true? A complete clone already holds both commits.
|
|
||
| pnpm test:a11y-contract # the Chromium lane (also runs inside pr-a11y) | ||
| pnpm test:a11y-contract # the Chromium lane, every spec (the release check) | ||
| pnpm test:a11y-contract:pr # the specs a pull request from this branch runs |
There was a problem hiding this comment.
Without a base the runner treats scope as unknown and runs every scoped spec plus the always ones (75 of 162 at this head), not what a pull request from this branch runs. Could this line be pnpm test:a11y-contract:pr origin/main --dry-run, or could the runner default the base to origin/main outside CI?
| # Release checks run only the always-on specs here: every spec runs in | ||
| # a11y-contracts. |
There was a problem hiding this comment.
Non-blocking: on main the release check uploaded richtext-markdown-parity-evidence-<sha7> from this job. The parity specs now run only in a11y-contracts-shard, whose uploads do not include test-results/richtext-markdown-parity/, so the release check no longer keeps that evidence. Worth adding it to a contract-shard upload, or noting the drop in the PR.
There was a problem hiding this comment.
This looks ready to approve: discovery keeps each pull request's browser-spec selection, job and check names are unchanged, and the earlier requested changes are in. Two optional follow-ups:
- CheckboxList and CheckboxListItem audits now run all 37 tests of
Checkbox.a11y.chromium.spec.tsinstead of the 10CheckboxListItem [bindings, which is worth stating in the description or filtering again. - The runner's
--reporter list,jsonreplaces the config's CIgithubreporter, so failing specs no longer annotate the pull request; addinggithubwhenGITHUB_ACTIONSis set would keep them.
[Automated review]
| '--config', | ||
| 'playwright.config.ts', | ||
| '--reporter', | ||
| 'list,json', |
There was a problem hiding this comment.
--reporter list,json replaces the CI reporters in playwright.config.ts (list and github), so a failing spec no longer raises a GitHub annotation; 49 of the removed Playwright steps used those reporters. Adding github to this list when GITHUB_ACTIONS is set would keep the annotations.
| * @param {string} title | ||
| */ | ||
| export function auditedComponents(title) { | ||
| const match = /^\[Component Audit\] ([A-Z]\w*):/.exec(title ?? ''); |
There was a problem hiding this comment.
The removed steps matched titles with GitHub's startsWith, which ignores case; this regex does not, so a title like [Component audit] DateInput: … now runs neither the audit spec nor its axe pass, and nothing is printed. Recent audit titles all use the canonical case, so this is latent; matching case-insensitively, or printing a notice for a near miss, would keep the old behavior.
| @@ -1,4 +1,5 @@ | |||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | |||
| // @pr-a11y audit CheckboxList, CheckboxListItem | |||
There was a problem hiding this comment.
The removed CheckboxList step ran this file with --grep 'CheckboxListItem \[' (10 tests). Routed by file, a CheckboxList or CheckboxListItem audit now runs all 37, including the CheckboxInput, DropdownMenuCheckboxItem and SelectableCard bindings. Worth stating in the PR body, or keeping the filter.
There was a problem hiding this comment.
This looks ready to approve: discovery keeps each pull request's browser-spec selection, job and check names are unchanged, and the release check still runs every spec. Two optional follow-ups:
- Audit titles are now matched case-sensitively (
.github/scripts/a11y-pr-contracts.mjs:142), while the removed steps'startsWithignored case, so a[Component audit] X:title would silently skip its audit spec and axe pass; matching case-insensitively or printing a notice for a near miss keeps the old behavior. ^packages/richtext/on the three Markdown parity specs is wider than thesrc/-only package check it replaces, so a richtextpackage.jsonorCHANGELOG.mdedit now runs them;^packages/richtext/src/keeps the selection unchanged.
[Automated review]
| @@ -1,4 +1,5 @@ | |||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | |||
| // @pr-a11y scope core/Markdown richtext/* ^(apps/storybook/stories/RichTextEditor\.(markdownParity|stories)|packages/richtext/src/__tests__/(MarkdownParitySandbox|RichTextView|RichTextEditorToolbar)) ^packages/richtext/ | |||
There was a problem hiding this comment.
^packages/richtext/ is wider than the check it replaces: the removed step ran these specs when analysis.json's changedPackages held @astryxdesign/richtext, and analyze-pr.js adds that only for files under packages/richtext/src/. A pull request that edits only packages/richtext/package.json or CHANGELOG.md now runs the three parity specs where main did not. ^packages/richtext/src/ here and in RichTextView and RichTextEditorToolbar keeps the selection unchanged.
…uting line Main's pr-a11y lane now discovers browser accessibility specs by file name (meta#8367), and a step that names a spec file fails ci-test-routing's "names no spec file in any step". This drops the "Run modal backdrop contract" step, so this pull request no longer touches ci.yml, and gives ModalBackdrop.a11y.browser.spec.ts a `@pr-a11y scope` line: a pull request runs it when it changes the spec, Dialog, AlertDialog, Drawer, MobileNav or BottomSheet, or their stories.
Takes main's ci.yml whole: the CheckboxList row press contract needs no workflow step of its own, since the pull-request accessibility run finds CheckboxListPress.a11y.chromium.spec.ts by its file name and runs it for a CheckboxList change (meta#8367); a step naming the spec fails main's routing test.
…ered browser spec main's pr-a11y job now discovers browser accessibility specs and routes each by its own @Pr-a11y lines (meta#8367), so the workflow step this pull request added is gone in the merge. The rest contract ran on every pull request through that step; `@pr-a11y always` keeps it there, as meta#8367 did for every spec it moved off a listed step.
ci.yml takes main's: main discovers every *.a11y.chromium.spec.ts (meta#8367), so the NumberInput stepper-press spec needs no step of its own.
ci.yml takes main's: main discovers every *.a11y.chromium.spec.ts (meta#8367), so the NumberInput stepper-focus spec needs no step of its own.
useScrollableArea.ts: main's meta#8388 same-commit remeasure (measureNow, measureRef, the gained-overflow layout effect) with this branch's scroll path (publish, measuredMapping/measuredOverflow, onScroll); main's comment style replaces the set-state-in-effect disables. ci.yml: main's, which discovers browser accessibility specs by file name (meta#8367), so this branch's explicit AppShell keyboard step is dropped and the spec runs by its AppShell folder.
A Link without href renders a <button>, and browsers set letter-spacing, word-spacing, text-transform and text-shadow on every <button>, so in uppercase, tracked or shadowed text its words stayed lowercase, untracked and plain beside an anchor form that matched the text. In Chromium 149, WebKit 26.5 and Firefox 151 the anchor form's words computed 3.2px / 4.8px / uppercase / shadow (134px wide) and the button form's normal / 0px / none / none (78px). The button form's own reset now inherits those four properties, as the anchor form already does; text-indent and text-align stay reset, because inherited they would indent or realign the button itself. A new story shows both forms in styled text, and a real-browser spec over it checks that the button form's words compute the same values and width as the anchor form's. pr-a11y selects the spec by name (meta#8367); its @Pr-a11y scope line runs it whenever Link's folder or its story changes. The change alters only appearance, so the changeset is a patch [feat] (spec:AST-017 FR3, DEC-17) that names the old and new look and the escape. component:Link calls the button form "styled as a link", but its FR6 lists only family, size, weight and line height as inherited; whether FR6 extends to these four is the open owner decision.
The workflow is main's: since meta#8367 pr-a11y discovers browser specs and ci-test-routing.test.mjs forbids naming one in a step, so the Slider steps this branch added go; its Slider specs run through discovery.
…#8381) ## User impact **Why:** Keyboard and screen reader users lose their place when a dialog inside an iframe closes: both ways to close it (2 of 2: Escape or a button) send focus to the frame's empty page. **What:** The dialog now returns focus to the control that opened it, with a ring after a key, none after a click. Picture-in-Picture windows were already fine. **How to check:** In the "Dialog in a second document" story, open the frame's dialog and press Escape: focus returns to "Open dialog", with its ring. ## Problem and solution fit What led here: we hit this moving one product onto Astryx, which renders some UI in a second window. Dialog remembers its opener as the page's `document.activeElement`, which for focus inside an iframe is the `<iframe>`. Focusing that `<iframe>` on close moves the frame's focus to its `<body>`. Options: - Follow the page's active element into iframes: misses Picture-in-Picture windows, which the page cannot see into. - Always read the dialog's own document: a page control opening a dialog inside an iframe would lose focus. - Read the dialog's own document while it has focus, else the page's: covers both. Chosen. For the ring, Dialog tracks its own document's input, which the page never hears. Skipping its focus call would change the page, where it hides WebKit's ring after a click. ## Expected behavior and authority `component:Dialog` (current) FR4 and AR2: closing returns focus to the element that opened it. `architecture:interaction-modality` (current) INV1: programmatic focus shows the ring only after keyboard input. Neither is page-only; #7356 fixed this for Popover. ## Smallest restoration - `Dialog.tsx`: record the opener as above, take the entry direction from its window, return focus with its document's modality. - Internal utils: `trackInteractionModalityIn(doc)`, counted so the last mounted Dialog removes its listeners; an optional document for `getInteractionModality`; an optional modality for `focusForLastInput`, which checks text fields against their own window. The page's tracker and other callers are unchanged. No public API, visual or timing change. ## Evidence - Reproduction before the change: main fails the iframe cases in Chromium and WebKit. - Result after the change: every case passes. - Representative unchanged path: the page Dialog passes before and after; the page's modality ignores other documents. - Regression test or other mutation-sensitive proof: the Testing cases, red without the fix. ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Testing - Unit tests (Vitest), 115 files and 3137 tests: Dialog and every other component that returns focus or reads the last input. New cases cover a control inside an iframe, a control in the page, a text field, and the input listeners going away when the last Dialog unmounts. Each new case fails on the code from before the fix it covers. - Browser test in Chromium, 10 cases (`DialogSecondDocument.a11y.browser.spec.ts`): the dialog in the page, an iframe and a Picture-in-Picture window, closed with Escape, with a click, and after a text field opened it, plus a page button that opens a dialog in the iframe. All pass. With the code from before the last review round (0d47027), the iframe and Picture-in-Picture text-field cases fail; with main's `Dialog.tsx`, the iframe cases fail. - The same test in WebKit 26.5: 7 pass, and the 3 Picture-in-Picture cases are skipped, since only Chromium has that window. - CI finds the test by its file name (#8367), and its routing line also covers its story and the two utilities. Locally, `pnpm test:a11y-contract:pr origin/main` picks it and passes 115 browser tests. - Typecheck, repo checks, ESLint and Prettier pass. Merged with our open #7732, #8014 and #7524, typecheck and the utility tests (516) pass; #7525, #7527 and #7529 each merge cleanly with this change.
Maintainer impact
Every new browser spec meant a workflow edit. In the last 30 days, 106 commits touched
.github/workflows/ci.yml; 69 of them only added apr-a11ystep for one spec (68 hand-listedplaywright teststeps plus their uploads, about 2,100 lines). A spec merged without its step got a green check and never ran on a pull request: 62 of 161 specs run only in the release check today.Intended invariant
spec:AST-030(current): PR accessibility stays scoped to changed components plus fast guards, and the release check runs every spec (FR12, DEC-5); new coverage joins thepr-a11yowner without a new lane or required context (FR11); job and required check names stay (FR7). Which specs a pull request runs does not change.Change
pr-a11yruns.github/scripts/a11y-pr-contracts.mjs(pnpm test:a11y-contract:prlocally) instead of hand-listed steps. It discovers specs fromplaywright.config.tsand runs the selected ones in one Playwright run with its own--outputdirectory. A spec runs on a pull request when the PR changes the spec, its component folder, or the component it is named after. A spec's header can change that with one line:@pr-a11y always,scope <component or ^path regex>,audit <Name>(a[Component Audit] <Name>:PR), orrelease-only.PopoverSecondDocument(new onmain), arerelease-only.pr-a11y-evidence/<name>-a11y-report.json, and fails when an audit that ran specs left no<name>-audit-evidence/receipts..github/a11y-audit-axe.jsonkeeps the audits that differ from that default: DateInput's open-calendar story and[role="dialog"]wait; the[role="menu"]wait for ContextMenuItem, DropdownMenuGroup, DropdownMenuDivider, and DropdownMenuItem; the CheckboxList pair; ChatTokenizedText'sASTRYX_AUDIT_BASELINE_HEAD; and the two audits whose receipts were optional.Checkbox.a11y.chromium.spec.ts(37 tests) rather than the 10CheckboxListItem [bindings the old step filtered to: routing selects files, not tests.pr-a11y-evidence-<sha7>: the selection, the JSON report, the audit axe reports, and each spec's receipt folder.pr-a11y, as before. The Markdown parity specs, which also ran there, still run ina11y-contractswith every other spec. The release check no longer uploads theirrichtext-markdown-parity-evidenceartifact (nothing reads it, and no record requires it); a pull request that touches Markdown or RichText still uploads those receipts inpr-a11y-evidence-<sha7>.pnpm test:a11y-contract:prcompares withorigin/mainby default and never deepens or truncates a complete clone; only CI's shallow checkout is fetched at a depth. Without CI'sanalysis.jsonit says that component tokens were not evaluated.The test-script and typecheck parts of the first version landed separately as #8389 and #8390. CONTRIBUTING gains "Where tests go, and how CI finds them".
Why the step deletions land together
The 2,147 deleted lines are the hand-listed steps the runner replaces. The review question for them is only "is each spec still selected exactly when it was?", and the equivalence model below answers that for all of them at once. Staging would mean a release in which the runner and hand-listed steps coexist. That needs a temporary routing mode that skips specs still listed, so the two cannot double-run or both miss a spec, and it adds a full CI and review round per stage, while every stage gets the same equivalence check. Each header line carries one spec's routing next to the spec, so it reviews and reverts with that spec.
Evidence
pr-a11ydiscovered 161 specs, selected 75 (the PR touched every spec file), and ran 641 tests in one Playwright run; selection took 15 s. Its axe step failed on a pre-existinglab/Schedulescrollable-region-focusableviolation, which ran only because that head touched Schedule's spec files. That defect is tracked separately. This head no longer touches Schedule..github/;pr-a11yselected it (76 of 162) and failed on it.Scope
Testing
vitest run --project node .github/scripts: workflow contracts updated.a11y-pr-contracts.test.mjscovers routing parsing and rejection, owners (a pattern's stem never claims another pattern's files), selection, unknown scope, audit titles, the audit axe plans (open-state waits included), and valid routing in every repository spec.pnpm test:a11y-contract:pr origin/main --dry-runwith a[Component Audit] DateInput:title selects the DateInput audit specs and plans the open-calendar axe pass.