Skip to content

ci: discover PR browser accessibility specs, so a new spec needs no workflow edit - #8367

Merged
cixzhang merged 4 commits into
mainfrom
ci/package-script-entrypoints
Oct 25, 2026
Merged

cixzhang merged 4 commits into
mainfrom
ci/package-script-entrypoints

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

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 a pr-a11y step for one spec (68 hand-listed playwright test steps 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 the pr-a11y owner 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-a11y runs .github/scripts/a11y-pr-contracts.mjs (pnpm test:a11y-contract:pr locally) instead of hand-listed steps. It discovers specs from playwright.config.ts and runs the selected ones in one Playwright run with its own --output directory. 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), or release-only.

  • 148 specs carry the line that reproduces their current routing; the other 14 are covered by the default. The 62 specs that never ran on a PR, including PopoverSecondDocument (new on main), are release-only.
  • Component-audit PRs keep their own axe pass. The runner audits the named component before its specs, writes 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.json keeps 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's ASTRYX_AUDIT_BASELINE_HEAD; and the two audits whose receipts were optional.
  • CheckboxList and CheckboxListItem audits run all of Checkbox.a11y.chromium.spec.ts (37 tests) rather than the 10 CheckboxListItem [ bindings the old step filtered to: routing selects files, not tests.
  • Evidence uploads become one artifact, pr-a11y-evidence-<sha7>: the selection, the JSON report, the audit axe reports, and each spec's receipt folder.
  • For an older PR head, the runner and every routing line (and the audit config) are read from the merge commit the steps come from. Open PRs do not need to merge main. The skip-absent-specs wrapper is deleted: discovery reads the head, so it never names a spec the head lacks.
  • Release checks run only the always-on specs in pr-a11y, as before. The Markdown parity specs, which also ran there, still run in a11y-contracts with every other spec. The release check no longer uploads their richtext-markdown-parity-evidence artifact (nothing reads it, and no record requires it); a pull request that touches Markdown or RichText still uploads those receipts in pr-a11y-evidence-<sha7>.
  • Locally, pnpm test:a11y-contract:pr compares with origin/main by default and never deepens or truncates a complete clone; only CI's shallow checkout is fetched at a depth. Without CI's analysis.json it 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

  • Same selection: a model of the 68 removed steps' conditions against the runner over 156 PR scopes (every component folder in core, lab, charts, richtext, and vega, every audit title, and no scope) drops 0 specs and adds 0. When the changed-file list is unknown, the runner errs toward more and runs every scoped spec.
  • Same tests in CI: on this PR's first head, pr-a11y discovered 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-existing lab/Schedule scrollable-region-focusable violation, which ran only because that head touched Schedule's spec files. That defect is tracked separately. This head no longer touches Schedule.
  • New spec, no workflow edit: probe DO NOT MERGE: CI probe for #8367 (new package + new browser spec, no workflow edit) #8368 (closed, never merged) added a failing browser spec in core with no change under .github/; pr-a11y selected it (76 of 162) and failed on it.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run --project node .github/scripts: workflow contracts updated. a11y-pr-contracts.test.mjs covers 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-run with a [Component Audit] DateInput: title selects the DateInput audit specs and plans the open-calendar axe pass.

@vercel

vercel Bot commented Oct 25, 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 Oct 25, 2026 2:54pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 25, 2026, 3:25 PM UTC

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-a11y migration 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.json and add pr-a11y-evidence/ and pr-a11y-output/ to .gitignore.

[Automated review]

Comment thread pr-a11y-evidence/selection.json Outdated
Comment on lines +1 to +2
{
"head": null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/ci.yml
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread CONTRIBUTING.md Outdated
Comment on lines +529 to +530
from your branch would run. Every spec writes its receipts under
`test-results/<name>/` and CI uploads them in one `pr-a11y-evidence-<sha>`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang cixzhang changed the title ci: run tests through package scripts and discover browser specs, so a new test needs no workflow edit ci: discover PR browser accessibility specs, so a new spec needs no workflow edit Oct 25, 2026
@cixzhang
cixzhang force-pushed the ci/package-script-entrypoints branch from 48b1383 to c7cb592 Compare October 25, 2026 08:26

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Comment thread .github/scripts/a11y-pr-contracts.mjs Outdated
Comment on lines +390 to +393
const [audited] = auditedComponents(title);
const auditConfigFile = '.github/a11y-audit-axe.json';
const plan = audited
? auditPlan(audited, readAuditConfig(root, auditConfigFile, policySha))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread .github/scripts/a11y-pr-contracts.mjs Outdated

function readComponents(root) {
const analysis = path.join(root, 'analysis.json');
if (!fs.existsSync(analysis)) return [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Comment thread .github/scripts/a11y-pr-contracts.mjs Outdated
Comment on lines +298 to +305
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}`]);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread CONTRIBUTING.md Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread .github/workflows/ci.yml
Comment on lines +1602 to +1603
# Release checks run only the always-on specs here: every spec runs in
# a11y-contracts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts instead of the 10 CheckboxListItem [ bindings, which is worth stating in the description or filtering again.
  • The runner's --reporter list,json replaces the config's CI github reporter, so failing specs no longer annotate the pull request; adding github when GITHUB_ACTIONS is set would keep them.

[Automated review]

Comment thread .github/scripts/a11y-pr-contracts.mjs Outdated
'--config',
'playwright.config.ts',
'--reporter',
'list,json',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--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 ?? '');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' startsWith ignored 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 the src/-only package check it replaces, so a richtext package.json or CHANGELOG.md edit 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/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^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.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
…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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
… this change

Takes meta#8076's ci.yml whole: the CheckboxList row press contract no longer
needs a 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).
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
…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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
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.
@github-actions
github-actions Bot deleted the ci/package-script-entrypoints branch October 26, 2026 06:31
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
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.
cixzhang pushed a commit that referenced this pull request Oct 30, 2026
…#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.

This branch was successfully deployed

1 active deployment
Preview — 6560ab95 Deployed Oct 25, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant