Repository navigation
fix(DropdownMenu): a custom trigger named by aria-labelledby names its menu - #13730
Conversation
Co-authored-by: Febiadi Wisnu Akbar <rheatkhs@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 66aa7d2 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/CommentThread | 387.9 kB (+190 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/AudioPlayer | 242.4 kB (+123 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/Comments | 394.7 kB (+115 B) · 2.5 kB CSS (0) | — | — · — · — |
26 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| MoreMenu | 137.0 kB (+105 B) · 20.1 kB CSS (0) | — | — · — · — |
| DropdownMenu | 136.8 kB (+85 B) · 20.1 kB CSS (0) | — | ✓ · ✓ · ✓ |
| lab/VideoPlayer | 240.3 kB (+71 B) · 2.1 kB CSS (0) | — | — · — · — |
| SideNav | 118.1 kB (+25 B) · 12.7 kB CSS (0) | — | — · — · — |
| lab/MediaTimeSlider | 232.4 kB (+22 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaVolume | 232.4 kB (+22 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaCaptionsButton | 232.4 kB (+21 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlaybackRate | 232.4 kB (+21 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaSeekButton | 232.4 kB (+21 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTime | 232.4 kB (+21 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlayButton | 232.4 kB (+20 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaFullscreenButton | 232.4 kB (+19 B) · 1.5 kB CSS (0) | — | — · — · — |
| ContextMenu | 110.0 kB (0) · 19.9 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 40.1 kB (0) · 7.4 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 30.3 kB (0) · 7.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
| DropdownMenuDivider | 5.4 kB (0) · 548 B CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuGroup | 6.6 kB (0) · 3.4 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuItem | 29.5 kB (0) · 7.2 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuRadioGroup | 6.7 kB (0) · 3.4 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuRadioItem | 30.3 kB (0) · 7.7 kB CSS (0) | — | ✓ · ✓ · — |
| DropdownMenuSubMenu | 82.9 kB (0) · 11.5 kB CSS (0) | — | ✓ · ✓ · ✓ |
| Markdown | 214.2 kB (0) · 23.8 kB CSS (0) | — | — · — · — |
| Table | 129.4 kB (0) · 21.5 kB CSS (0) | — | — · — · — |
| TableCell | 111.1 kB (0) · 20.5 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 111.0 kB (0) · 20.3 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 106.4 kB (−7 B) · 14.3 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 8.05 MB packed (+699 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the menu now takes its name in the reported case, but it loses its name when a trigger's aria-labelledby points at nothing.
readNameReference(DropdownMenu.tsx:580-583) hands the menu any non-emptyaria-labelledby, so a trigger whose ids resolve to no element, or only to empty text, is still named by its visible text but now opens an unnamed menu where main used that text: use the ids only when they resolve to non-empty text (sharing that check withreadAccessibleNameinutils/accessibleName.ts), fall back to the triggeridotherwise, and add a test with a dangling reference.- MoreMenu also imports
DropdownMenu.tsxand ships the new code without using it, so the import-boundaries record (INV10) asks for the base-against-head first-load gzip delta on each of the four reference pages; please add those numbers to the description.
Two small cleanups: readNameReference sits between resolveCustomTriggerMenuName and that function's doc comment, and the id doc on DropdownMenuTriggerProps still says the menu always points at that id.
Claims and files checked
Review mode: same-head; reason: none
- Changed rules (1): an owner's change request stays unresolved (maintainer-account dismissal). Checked: this pull request's reviews and comments; no owner change request or dismissal, no finding.
- Claim: before, a trigger named by
aria-labelledbyopened an unnamed menu, because the menu pointed at the trigger and a name reference is not followed twice. Verified from main's menu wiring and the name-computation rule. - Claim: after, the menu points at the trigger's ids and is named "Project actions". Verified in the code, and the new test asserts it.
- Claim: the Button path, triggers named by content or
aria-label, and a calleraria-labelon the menu are unchanged. Verified. - Claim: a trigger without
aria-labelledbykeeps today's behaviour. Verified. A trigger whosearia-labelledbyresolves to nothing does not keep it (first bullet). - Claim: a drilled-in menu still takes no name. Verified.
- Claim: the record gains one AR1 sentence. Verified, and an engineering owner approved it for this head.
- Claim: the new test fails on main and passes here. Consistent with the code; no run confirms it.
- Claim: the DropdownMenu tests, typecheck, knowledge check, prettier and eslint pass. Not verified; CI has not run on this head.
- Claim: the pull request carries the earlier fix forward with that review's asks. Partly false: the caller precedence, the callback read and the citation are fixed, but the fallback for unresolved ids is not.
- Claim: the co-author is credited. Verified in a commit trailer.
- Claim: the overlapping pull requests do not set the menu's
aria-labelledby. Not checked; it does not bear on this verdict. - Changeset: a custom trigger named by
aria-labelledbynow names its open menu. Verified for the pointer popover; the bottom sheet already took this name. - File
.changeset/dropdown-menu-labelledby-trigger-name.md: clear. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear. FR9's wiring sentence could name the new exception. - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear, but it needs a dangling-reference case (first bullet). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: the first bullet and the misplaced doc comment.
|
/approve-spec f330d2a |
There was a problem hiding this comment.
Changes requested: the menu now takes its name in the reported case, but it loses its name when a trigger's aria-labelledby points at nothing. The merge from main leaves both points below open.
readNameReference(DropdownMenu.tsx:580-583) hands the menu any non-emptyaria-labelledby, so a trigger whose ids resolve to no element, or only to empty text, is still named by its visible text but now opens an unnamed menu where main used that text: use the ids only when they resolve to non-empty text (sharing that check withreadAccessibleNameinutils/accessibleName.ts), fall back to the triggeridotherwise, and add a test with a dangling reference.- MoreMenu also imports
DropdownMenu.tsxand ships the new code without using it, so the import-boundaries record (INV10) asks for the base-against-head first-load gzip delta on each of the four reference pages; please add those numbers to the description.
Two small cleanups: readNameReference sits between resolveCustomTriggerMenuName and that function's doc comment, and the id doc on DropdownMenuTriggerProps still says the menu always points at that id.
Claims and files checked
Review mode: carry-forward; reason: none
- Claim: before, a trigger named by
aria-labelledbyopened an unnamed menu, because the menu pointed at the trigger and a name reference is not followed twice. Verified from main's menu wiring and the name-computation rule. - Claim: after, the menu points at the trigger's ids and is named "Project actions". Verified in the code, and the new test asserts it.
- Claim: the Button path, triggers named by content or
aria-label, and a calleraria-labelon the menu are unchanged. Verified. - Claim: a trigger without
aria-labelledbykeeps today's behaviour. Verified. A trigger whosearia-labelledbyresolves to nothing does not keep it (first bullet). - Claim: a drilled-in menu still takes no name. Verified.
- Claim: the record gains one AR1 sentence. Verified, and an engineering owner approved it for this head.
- Claim: the new test fails on main and passes here. Consistent with the code; no run confirms it.
- Claim: the DropdownMenu tests, typecheck, knowledge check, prettier and eslint pass. Not verified; CI has not run on this head.
- Claim: the pull request carries the earlier fix forward with that review's asks. Partly false: the caller precedence, the callback read and the citation are fixed, but the fallback for unresolved ids is not.
- Claim: the co-author is credited. Verified in a commit trailer.
- Claim: the overlapping pull requests do not set the menu's
aria-labelledby. Not checked; it does not bear on this verdict. - Changeset: a custom trigger named by
aria-labelledbynow names its open menu. Verified for the pointer popover; the bottom sheet already took this name. - File
.changeset/dropdown-menu-labelledby-trigger-name.md: clear. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear. FR9's wiring sentence could name the new exception. - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear, but it needs a dangling-reference case (first bullet). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: the first bullet and the misplaced doc comment.
…ls back to the trigger id Co-authored-by: Febiadi Wisnu Akbar <rheatkhs@gmail.com>
|
/approve-spec 4a34b4c |
There was a problem hiding this comment.
Approved pending CI: a custom trigger named by aria-labelledby now names its open menu, and a trigger whose aria-labelledby points at nothing keeps the menu named by its own text. CI is still running on this head, and its one failing job, test-ui (1/4), fails on a List reorder timing test this change does not reach; main fixed that test in #13755, so merging main should clear it.
Optional touches: FR9 in the DropdownMenu record still says the menu points at the trigger's id, so one clause there would match the new AR1 sentence; the changeset could say "in the pointer popover", since the bottom sheet already took this name; and a stray blank line is left at DropdownMenu.tsx:595.
Claims and files checked
Review mode: same-head; reason: none
- Claim: before, a trigger named by
aria-labelledbyopened an unnamed menu, because the menu pointed at the trigger and a name reference is not followed twice. Verified from main's menu wiring (DropdownMenu.tsx:1930on main) and the name-computation rule. - Claim: after, the menu points at the same ids and is announced by the trigger's name. Verified at
DropdownMenu.tsx:1949-1955; the new test atDropdownMenu.test.tsx:4250-4275asserts it and passed in CI. - Claim: the Button path, a custom trigger named by its content or by
aria-label, and a calleraria-labelon the menu are unchanged. Verified atDropdownMenu.tsx:1942-1955; the existing content-named test (DropdownMenu.test.tsx:4215-4248) passed in CI. - Claim: the trigger's
aria-labelledbyis read as the menu opens, beside the name already read for the Back row. Verified atDropdownMenu.tsx:1176-1177. - Claim: a trigger without
aria-labelledby, or whose ids resolve to no element or only to empty text, keeps today's behaviour. Verified atDropdownMenu.tsx:583-588andutils/accessibleName.ts:39-53; the dangling case is tested, and the empty-text case follows from the same check. - Claim: the resolve check is shared with
readAccessibleNamethrough a new internal helper. Verified atutils/accessibleName.ts:39-53and:67-70;readAccessibleNamereturns the same names as before. - Claim: a drilled-in menu still takes no name. Verified at
DropdownMenu.tsx:1950-1951. - Claim: the record gains one AR1 sentence. Verified at
DropdownMenu.spec.md:205-207, and an engineering owner approved it for this head. - Claim: two new custom-trigger tests, the first failing on main and the second failing on the earlier revision of this pull request. Verified by reading: main points the menu at the trigger's own id, so the first test's
aria-labelledbyassertion cannot pass there, and the earlier revision passed any non-empty reference through, so the second test's fallback assertion could not pass there; both pass in CI at this head. - Claim: the
iddoc onDropdownMenuTriggerPropssays the menu points at the trigger's own ids when they resolve to text. Verified atDropdownMenu.tsx:397-401. - Claim: a patch changeset is added. Verified.
- Claim: the DropdownMenu and utils tests pass, the typecheck is clean, the knowledge check is aligned, and formatting and lint are clean. Verified in CI at this head: the DropdownMenu tests (248) and the utils tests in the finished shards passed, and the typecheck, knowledge check, formatting and ESLint steps passed; the 1809 tally is the author's own run.
- Claim: on the four reference pages the first-load size is unchanged for docs, form and table, the menu page grows by 84 bytes gzip, and no module graph changes. Not rebuilt here; consistent with CI's size report for this head, under the import-boundaries record's 0.3 KB limit, and CI's import-boundaries check passed.
- Claim: the record sentence passes the writing rubric (present tense, no narration). Verified.
- Claim: the pull request fixes the reported issue and credits the earlier contributor as co-author. Verified in the issue and the commit trailers.
- Claim: the overlapping pull requests do not set the menu's
aria-labelledby. Verified: of the eight listed, only the earlier pull request for the same issue addsaria-labelledbyto DropdownMenu files. - Claim: this merges after the DropdownMenu change it waits on, through specs, code review, CI and merge. A process note; that change is still open, and this pull request is now out of draft.
- Changeset: a custom trigger named by
aria-labelledbynow names its open menu. Verified for the pointer popover; the bottom sheet already took this name. - File
.changeset/dropdown-menu-labelledby-trigger-name.md: clear; "in the pointer popover" would make it exact. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear; FR9's wiring sentence could name the new exception. - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: clear; a stray blank line at line 595. - File
packages/core/src/utils/accessibleName.ts: clear.
| * when it is a non-empty string, else the trigger's own accessible name. The | ||
| * popover and the bottom sheet both name the menu through this. | ||
| */ | ||
|
|
There was a problem hiding this comment.
Nit: moving the helper left this blank line between resolveCustomTriggerMenuName's doc comment and the function. Drop it so the comment sits directly on the function it documents.
|
/approve-spec b8b228e |
There was a problem hiding this comment.
Approved: a custom trigger named by aria-labelledby now names its open menu, and a trigger whose aria-labelledby points at nothing keeps the menu named by its own text. CI passes on this head, including both new DropdownMenu cases.
Optional touches: a stray blank line remains at DropdownMenu.tsx:596; FR9 in the DropdownMenu record still says the menu points at the trigger's id, so one clause there would match the new AR1 sentence; the changeset could say "in the pointer popover", since the bottom sheet already took this name; and a Chromium accessibility-tree case for the heading-labelled trigger would prove the computed name in a browser, since the new tests run in jsdom.
Claims and files checked
Review mode: same-head; reason: none
- Claim: before, a trigger named by
aria-labelledbyopened an unnamed menu, because the menu pointed at the trigger and a name reference is not followed twice. Verified from main's menu wiring (DropdownMenu.tsx:1931on main) and the name-computation rule. - Claim: after, the menu points at the same ids and takes the trigger's name. Verified at
DropdownMenu.tsx:1950-1956; the new test atDropdownMenu.test.tsx:4284-4309asserts it and passes in CI on this head. - Claim: the Button path, a custom trigger named by its content or by
aria-label, and a calleraria-labelon the menu are unchanged. Verified atDropdownMenu.tsx:1943-1956and by the existing content-named test (DropdownMenu.test.tsx:4249-4282). - Claim: the trigger's
aria-labelledbyis read as the menu opens, beside the name already read for the Back row. Verified atDropdownMenu.tsx:1177-1178. - Claim: a trigger without
aria-labelledby, or whose ids resolve to no element or only to empty text, keeps today's behaviour. Verified atDropdownMenu.tsx:584-589andutils/accessibleName.ts:39-53; the dangling case is tested (DropdownMenu.test.tsx:4311-4333), and the empty-text case follows from the same check. - Claim: the resolve check is shared with
readAccessibleNamethrough a new internal helper. Verified atutils/accessibleName.ts:39-53and:67-70;readAccessibleNamereturns the same names as before. - Claim: a drilled-in menu still takes no name. Verified at
DropdownMenu.tsx:1951-1952. - Claim: the record gains one AR1 sentence, governed by FR9 and AR1. Verified at
DropdownMenu.spec.md:139,:203and:206-208, and an engineering owner approved it for this head. - Claim: two new custom-trigger tests, the first failing on main and the second failing on the earlier revision of this pull request. Verified by reading: main points the menu at the trigger's own id, and the earlier revision passed any non-empty reference through; both pass in CI on this head.
- Claim: the
iddoc onDropdownMenuTriggerPropssays the menu points at the trigger's own ids when they resolve to text. Verified atDropdownMenu.tsx:398-402. - Claim: a patch changeset is added. Verified.
- Claim: the DropdownMenu and utils tests pass, the typecheck is clean, the knowledge check is aligned, and formatting and lint are clean. Verified in CI on this head for the typecheck, lint and the DropdownMenu and SideNav test files; the test tally is the author's own run.
- Claim: on the four reference pages first-load size is unchanged for docs, form and table, and the menu page grows by 84 bytes gzip. Not rebuilt here; under the import-boundaries record's 0.3 KB limit as reported.
- Claim: the record sentence passes the writing rubric. Verified: present tense, no narration or status.
- Claim: the pull request fixes the reported issue and credits the earlier contributor as co-author. Verified in the issue and the commit trailers.
- Claim: the overlapping pull requests do not set the menu's
aria-labelledby. Verified: of the eight listed, only the earlier pull request for the same issue addsaria-labelledbylines to DropdownMenu files. - Claim: this merges after the DropdownMenu change it waits on. A process note; that change is still open, and the land path still says draft although the pull request is now ready for review.
- Changeset: a custom trigger named by
aria-labelledbynow names its open menu. Verified for the pointer popover; the bottom sheet already took this name. - File
.changeset/dropdown-menu-labelledby-trigger-name.md: clear; "in the pointer popover" would make it exact. - File
docs/specs/components/DropdownMenu/DropdownMenu.spec.md: clear; FR9's wiring sentence could name the new exception. - File
packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear. - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: clear; a stray blank line at line 596. - File
packages/core/src/utils/accessibleName.ts: clear.
Primary intent
Bug fix: a DropdownMenu whose custom trigger (
renderTrigger) is named byaria-labelledbynow gives its open menu the same name.User impact
aria-labelledbywas skipped.aria-labelfrom the button's label), a custom trigger named by its content or byaria-label, and a calleraria-labelon the menu.Change
DropdownMenu.tsx(popover): as the menu opens, it reads the custom trigger'saria-labelledby(beside the accessible name it already reads for the Back row) and points the menu'saria-labelledbyat those ids. Fallback: a trigger withoutaria-labelledby, or whose ids resolve to no element or only to empty text, keeps today's behaviour, and the menu points at the trigger'sid(the trigger is still named by its own text). The resolve check is shared withreadAccessibleNamethrough a new internallabelledByTexthelper inutils/accessibleName.ts. A drilled-in menu still takes no name of its own (fix(DropdownMenu, ContextMenu): a drilled-in sub-menu is the one menu in the accessibility tree #13678).component:DropdownMenuAR1): one consistency sentence: when the control names itself byaria-labelledby, the open menu points at the same ids, because a name reference does not follow a second reference.aria-labelledby="missing": the menu keeps the trigger's own name and points at itsid(fails on the earlier head of this PR, passes here).DropdownMenuTriggerProps.idJSDoc: says the menu points at the trigger's own ids when they resolve to text.[fix]patch.Authority
component:DropdownMenuFR9 ("the menu is named by that control") and AR1 ("A custom trigger still names the menu"). Records-decided defect; AR1 gains a consistency sentence.Evidence
Red first: the new case fails on main and passes here.
Units: DropdownMenu and utils pass, 1809, on current main. tsc is clean.
check:knowledgeis aligned; prettier and eslint are clean.First-load size (
component-import-boundariesINV10), frompnpm size:pages --base <main 6d1ed2ed> --unused-on menuat this head, esbuild, minified / gzip bytes:The module graph is unchanged on every page. The menu page, which also covers MoreMenu's import of
DropdownMenu.tsx, grows +84 B gzip: PASS against INV10's 0.3 KB limit.Writing rubric results
Scope
Components: DropdownMenu.
Fixes #13651. Thanks to @korkt-kim for the precise report and reproduction, and to @rheatkhs, whose #13671 found the same cause first. This carries that fix forward with the review's asks; rheatkhs is credited as co-author.
Overlap
Overlap checked: #13671, #12582, #12350, #12226, #12216, #11297, #8217, #6819 (#13671 is rheatkhs's idle PR for the same issue, carried forward here with credit, and it closes with thanks when this merges; the others share DropdownMenu files for unrelated behaviour, such as the sheet sub-menu, bottom-sheet keys, disabled reasons, touch outside, pointer-open focus, ChatLayout drag and Selector defaults, and none sets the menu's aria-labelledby)
Owner and land path