Skip to content

fix(Dialog): a DialogHeader that mounts after the dialog opens names it - #11828

Merged
cixzhang merged 3 commits into
mainfrom
l0/dialog-late-header-name
Nov 20, 2026
Merged

cixzhang merged 3 commits into
mainfrom
l0/dialog-late-header-name

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: screen-reader users of a Dialog whose DialogHeader mounts after the dialog opens. For example, a form component that renders its own header once the dialog is open.
  • Before: the dialog had no accessible name, so a screen reader announced an unnamed dialog even though a heading was on screen. Apps worked around it by repeating the heading text in an aria-label.
  • After: the dialog is named by its DialogHeader title whenever that title is mounted. When the header unmounts, the name goes with it.
  • Also changed: an aria-label that arrives while a DialogHeader is mounted now names the dialog. Before, it lost to the header title. A test covers it.
  • Unchanged: a dialog's own aria-labelledby wins, including one that arrives later, and an aria-label given from the start wins. A header present on the first render names the dialog as before.

What changed

  • DialogHeader.tsx: the title's callback ref reports its mount and unmount through the dialog context (syncDefaultName(true | false)). No new Effect.
  • Dialog.tsx: syncDefaultName takes an optional isTitleMounted. true sets the default aria-labelledby. false clears it only when it is still the default, so a caller name that arrived meanwhile stays. With no argument it looks for the title again, as before, for composed headers.
  • DialogContext.ts: the hook's type and doc.
  • component:Dialog record: AR4 "Without its own aria-label or aria-labelledby, a Dialog is named by its DialogHeader title whenever that title is mounted", plus its verification row.
  • [fix] changeset.

Evidence

  • Red first: Dialog.test.tsx "is named by a DialogHeader that mounts after the dialog opens, until it unmounts" fails on main, which leaves the dialog unnamed, and passes here.
  • Caller names win: "keeps a consumer aria-labelledby when a DialogHeader mounts after the dialog opens" and "keeps a consumer aria-labelledby that arrives while a DialogHeader is mounted".
  • Dialog and AlertDialog suites pass (249 tests). Strict eslint, core tsc and check:knowledge are clean.
  • Records: WCAG 4.1.2 through spec:AST-020 FR1, and the existing default-name intent in component:Dialog and module:Dialog/DialogHeader. AR4 states that intent for a header that mounts late.

Writing rubric results

Record touched: component:Dialog (AR4 and its verification row).

  • R1 narration: none. AR4 states what names the dialog, in the present tense.
  • R2 research: none.
  • R3 evidence: the verification row names the test cases, not a pull request.
  • R4 rejected alternatives: none added.
  • R5 change references: none.
  • R6 open questions: none touched.
  • R7 project status: none.

Preflight

pnpm preflight at 1124f6b (main ee65f4f merged), run on a separate build machine: review:pre, build, typecheck, lint, vitest ui, knowledge and changesets PASS. vitest node failed only .github/scripts/lib/offline-media.test.mjs's two real-browser cases, because that machine reaches the network through a proxy that holds an unreachable host open; re-run without the proxy, the file passes 24/24. No other failure.

Scope

  • Dialog, DialogHeader and DialogContext, one test file, the record, and a changeset.
  • No public API change: the context is internal.
  • Public text contains no internal context.

Overlap checked: #11204 (draft by nynexman4464: a late-mounting header no longer takes focus from a control inside the dialog; that is focus, this is naming, and both touch DialogHeader.tsx without overlapping lines), and #11451, #11203, #11121 (Dialog.tsx and Dialog.test.tsx; text color, nested initial focus and focus return; no shared lines). Whichever merges second merges main.

Reported by @qufeng33 in #11981, which traces the same gap: a DialogHeader that renders after the dialog mounted never calls syncDefaultName, so the dialog stays unnamed.

Fixes #11981

Owner: Astryx fix-loop lane 0. Land path: CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue.

Dialog set its default aria-labelledby only in its own callback ref, so a
header that mounted later never named it. The header title's callback ref
now reports its mount and unmount through the dialog context, and the
dialog sets or clears the default name. A caller aria-label or
aria-labelledby still wins, including one that arrives later. Dialog's
record gains AR4.
@vercel

vercel Bot commented Nov 15, 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 Nov 20, 2026 3:15am UTC

Request Review

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

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 20, 2026, 5:31 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b14a8ab

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1124f6b

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/CommentThread 379.5 kB (+71 B) · 2.4 kB CSS (0) — — · — · —
lab/Comments 386.5 kB (+64 B) · 2.5 kB CSS (0) — — · — · —
DialogHeader 70.5 kB (+45 B) · 12.8 kB CSS (0) — ✓ · ✓ · ✓
8 more components
Component Size LoC Visual · A11y · RTL
Dialog 27.8 kB (+33 B) · 7.3 kB CSS (0) — ✓ · ✓ · —
AlertDialog 132.8 kB (+26 B) · 16.2 kB CSS (0) — — · — · —
CommandPalette 82.5 kB (+25 B) · 13.5 kB CSS (0) — — · — · —
Tokenizer 111.0 kB (+1 B) · 21.5 kB CSS (0) — — · — · —
CommandPaletteInput 33.9 kB (0) · 7.9 kB CSS (0) — — · — · —
CommandPaletteItem 13.6 kB (0) · 3.6 kB CSS (0) — — · — · —
lab/DialogHeroHeader 91.7 kB (0) · 372 B CSS (0) — — · — · —
PowerSearch 316.2 kB (−1 B) · 26.9 kB CSS (0) — — · — · —

Package size: @astryxdesign/core 7.85 MB packed (+396 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@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 fix works, but the release note and the description misstate one case it changes.

  • The changeset and the description's "Unchanged" bullet say a dialog's own aria-label still wins as before, but on main an aria-label that arrives while a DialogHeader is mounted loses to the header title, and this change makes it win without saying so or testing it.

Please reword the changeset and the description (and the commit message, if it stays) to say that a late aria-label now names the dialog instead of losing to the header title, and add a Dialog.test.tsx case for it that AR4's verification row names. The new AR4 verification row is also missing its Audit section cell (non-blocking).

Claims and files checked

Review mode: same-head; reason: none

  • Claims checked
    • Changeset: a header that mounts after the dialog opens now names it, and the name goes when it unmounts: verified (the new test fails on main and passes here; the Chromium accessibility tree agrees).
    • Changeset: a dialog's own aria-label or aria-labelledby still wins: false for an aria-label that arrives while a header is mounted, which main ignored and this change honors.
    • Description, Who and Before: the dialog was unnamed with a late header, and apps repeated the heading in aria-label: verified against main.
    • Description, After: named by the title while it is mounted, unnamed after it unmounts: verified.
    • Description, Unchanged: a caller name always wins, including one that arrives later: verified for aria-labelledby, false for a late aria-label.
    • Description, Unchanged: a header present on the first render names the dialog as before: verified.
    • The title's callback ref reports mount and unmount, with no new Effect: verified in DialogHeader.tsx.
    • syncDefaultName sets on true, clears only its own default on false, and looks again with no argument: verified in Dialog.tsx.
    • The context type and doc change: verified in DialogContext.ts.
    • The record gains AR4 and a verification row: verified; the row has no Audit section cell.
    • A [fix] changeset: present, in the repository's format.
    • The red-first test fails on main and passes here: verified.
    • The two caller-name tests pass: verified; they also pass on main.
    • The Dialog and AlertDialog suites pass (249 tests): verified.
    • Strict lint, the core typecheck and the knowledge check are clean: verified.
    • The cited records (the WCAG name baseline and the existing default-name intent): verified as intent; AR4 is the first clause that states it.
    • Writing rubric results for the record: verified; AR4 is present tense, and the row names test cases, not a pull request.
    • No public API change, and the context stays internal: verified (the generated surface comparison shows no rows).
    • Public text contains no internal context: verified.
    • Overlap with #11204, #11451, #11203 and #11121: verified; each merges with this head with no conflict in this pull request's files.
  • Files checked
    • .changeset/dialog-late-header-name.md: finding (caller-name claim).
    • docs/specs/components/Dialog/Dialog.spec.md: clear; the AR4 row lacks its Audit section cell (non-blocking).
    • packages/core/src/Dialog/Dialog.test.tsx: clear; no case for a late aria-label.
    • packages/core/src/Dialog/Dialog.tsx: clear.
    • packages/core/src/Dialog/DialogContext.ts: clear.
    • packages/core/src/Dialog/DialogHeader.tsx: clear.

Automated review (maintainer link)

Comment thread .changeset/dialog-late-header-name.md Resolved
…names the dialog

The release note says so, and AR4's verification row names the case and
its audit section.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2450d9a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026

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

Approved pending CI: CI has not run on this head yet.

A DialogHeader that mounts after the dialog opens now names it, and the late aria-label case is described in the release note and covered by a test that fails on main. One non-blocking point:

  • The description's Evidence bullet says the Dialog and AlertDialog suites pass with 249 tests; with the new case they run 250.
Claims and files checked

Review mode: same-head; reason: none

  • Claims checked
    • Changeset: a header that mounts after the dialog opens now names it, and the name goes when it unmounts: verified (the new test fails on main and passes here; Chromium's accessibility tree agrees).
    • Changeset: a dialog's own aria-label or aria-labelledby wins: verified (the caller-name tests and the accessibility tree).
    • Changeset: an aria-label that arrives while the header is mounted now names the dialog instead of losing to the header title: verified (its new test fails on main and passes here).
    • Description, Who and Before: a late header left the dialog unnamed, and apps repeated the heading in aria-label: verified against main; the workaround is context.
    • Description, After: named by the title while it is mounted, unnamed after it unmounts: verified.
    • Description, Also changed: a late aria-label now names the dialog, and a test covers it: verified.
    • Description, Unchanged: a caller aria-labelledby wins, a late one included; an aria-label given from the start wins; a header on the first render names the dialog as before: verified on main and here.
    • The title's callback ref reports mount and unmount, with no new Effect: verified in DialogHeader.tsx.
    • syncDefaultName sets on true, clears only its own default on false, and looks again with no argument: verified in Dialog.tsx.
    • The context type and doc change: verified in DialogContext.ts.
    • The record gains AR4 and a verification row: verified, with its audit section.
    • A [fix] changeset: present, in the repository's format.
    • Red first: the late-header test fails on main and passes here: verified.
    • The caller-name tests pass: verified; they also pass on main.
    • The Dialog and AlertDialog suites pass (249 tests): they pass; the count is 250 here.
    • Strict lint, the core typecheck and the knowledge check are clean: verified.
    • The cited records: the WCAG name baseline and the header record's naming clause are verified; the Dialog record had no naming clause before this change, and AR4 adds it.
    • Writing rubric results for the record: verified; AR4 is present tense, and the row names test cases.
    • Scope (three Dialog files, one test file, the record and a changeset): verified.
    • No public API change, and the context stays internal: verified (the generated surface comparison shows no rows).
    • Public text contains no internal context: verified.
    • Overlap with #11204, #11451, #11203 and #11121: verified; none changes a line this pull request changes.
    • Reported in #11981, and fixes it: verified; both patterns in the issue, content rendered on open and an imperative show, are named at the accessibility tree.
    • Owner and land path: process context; the spec approval for this head is recorded and CI has not run.
  • Files checked
    • .changeset/dialog-late-header-name.md: clear.
    • docs/specs/components/Dialog/Dialog.spec.md: clear.
    • packages/core/src/Dialog/Dialog.test.tsx: clear.
    • packages/core/src/Dialog/Dialog.tsx: clear.
    • packages/core/src/Dialog/DialogContext.ts: clear.
    • packages/core/src/Dialog/DialogHeader.tsx: clear.

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 20, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 1124f6b

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 20, 2026

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

Approved pending CI: CI is still running on this head.

A DialogHeader that mounts after the dialog opens now names it, the name goes when the header unmounts, and an aria-label that arrives while the header is mounted now wins; the tests for both cases fail on main and pass here, and Chromium's accessibility tree shows the same names. One non-blocking point:

  • The description's Evidence bullet says the Dialog and AlertDialog suites pass with 249 tests; after the merge of main they run 257.
Claims and files checked

Review mode: same-head; reason: none

  • Changed rules since the last review: changed rules (0): none
  • Claims checked
    • Changeset: a header that mounts after the dialog opens now names it, and the name goes when it unmounts: verified (the new test fails on main and passes here; Chromium's accessibility tree agrees).
    • Changeset: a dialog's own aria-label or aria-labelledby wins: verified (the caller-name tests, and the accessibility tree for an aria-label and for an aria-labelledby inside the dialog).
    • Changeset: an aria-label that arrives while the header is mounted now names the dialog instead of losing to the header title: verified (its test fails on main and passes here).
    • Description, Who and Before: a late header left the dialog unnamed, and apps repeated the heading in aria-label: verified against main; the workaround is context.
    • Description, After: named by the title while it is mounted, unnamed after it unmounts: verified.
    • Description, Also changed: a late aria-label now names the dialog, and a test covers it: verified.
    • Description, Unchanged: a caller aria-labelledby wins, a late one included; an aria-label given from the start wins; a header on the first render names the dialog as before: verified on main and here.
    • The title's callback ref reports mount and unmount, with no new Effect: verified in DialogHeader.tsx.
    • syncDefaultName sets on true, clears only its own default on false, and looks again with no argument: verified in Dialog.tsx.
    • The context type and doc change: verified in DialogContext.ts.
    • The record gains AR4 and a verification row: verified, with its audit section.
    • A [fix] changeset: present and valid.
    • Red first: the late-header test fails on main and passes here: verified (two cases fail on main).
    • The caller-name tests pass: verified; they also pass on main.
    • The Dialog and AlertDialog suites pass (249 tests): they pass; the count is 257 here after the merge of main.
    • Strict lint, the core typecheck and the knowledge check are clean: verified; CI's lint and typecheck also pass on this head.
    • The cited records: the WCAG name baseline and the header record's naming clause are verified; the Dialog record had no naming clause before this change, and AR4 adds it.
    • Writing rubric results for the record: verified; AR4 is present tense, and the row names test cases.
    • Preflight: build, typecheck, lint, UI tests, knowledge and changeset checks pass, and the only node test failures came from the author's network proxy: consistent with CI on this head (build, typecheck, lint and every node test shard pass; three of four UI test shards had passed and the fourth was running); the author's own run cannot be reproduced here.
    • Scope (three Dialog files, one test file, the record and a changeset): verified.
    • No public API change, and the context stays internal: verified (the built surface comparison and CI's API report show no rows).
    • Public text contains no internal context: verified.
    • Overlap with four other pull requests: the two focus fixes have merged into main and this head includes them; the two open drafts still merge cleanly with this head.
    • Reported in the linked issue, which this fixes: verified; the issue is open and both of its reproductions are named here.
    • Owner and land path: process context, not a product claim.
  • Files checked
    • .changeset/dialog-late-header-name.md: clear.
    • docs/specs/components/Dialog/Dialog.spec.md: clear (AR4 and its row; the table re-pad changes no other row's text).
    • packages/core/src/Dialog/Dialog.test.tsx: clear.
    • packages/core/src/Dialog/Dialog.tsx: clear.
    • packages/core/src/Dialog/DialogContext.ts: clear.
    • packages/core/src/Dialog/DialogHeader.tsx: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 20, 2026 05:09
@cixzhang
cixzhang merged commit 4fd75f4 into main Nov 20, 2026
151 checks passed
@github-actions
github-actions Bot deleted the l0/dialog-late-header-name branch November 21, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 1124f6b4 Deployed Nov 20, 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.

[Bug] Dialog: a DialogHeader rendered after the dialog mounted never names it

1 participant