Repository navigation
fix(DropdownMenu): a waiting open still takes focus and fires onClick - #11905
Conversation
DropdownMenu read a layer open that waits for a valid anchor as a refused open. A menu in a closed <dialog> that the page displays opens one commit after the press, so focus stayed on the trigger and onClick never fired. An open that waits for a settling ancestor did the same. The layer now tells its owner when a show() that it accepted starts to wait, and when that wait ends: an internal useLayer option, which usePopover passes through. The menu keeps its focus and click armed while the open waits, and clears them on a hide or a real refusal.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 2ecf502 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenu | 107.5 kB (+123 B) · 18.8 kB CSS (0) | — | ✗ · ✓ · ✓ |
| DropdownMenuSubMenu | 78.5 kB (+40 B) · 10.4 kB CSS (0) | — | ✗ · ✓ · ✓ |
| DropdownMenuCheckboxItem | 28.6 kB (0) · 7.3 kB CSS (0) | — | ✗ · ✓ · ✓ |
122 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenuDivider | 5.3 kB (0) · 548 B CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuGroup | 6.4 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuItem | 27.8 kB (0) · 6.9 kB CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuRadioGroup | 6.6 kB (0) · 3.3 kB CSS (0) | — | ✗ · ✓ · — |
| DropdownMenuRadioItem | 28.6 kB (0) · 7.3 kB CSS (0) | — | ✗ · ✓ · — |
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | ✓ · ✓ · ✗ |
| MoreMenu | 107.7 kB (+136 B) · 18.8 kB CSS (0) | — | — · — · — |
| lab/Comments | 369.9 kB (+125 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 363.1 kB (+121 B) · 2.4 kB CSS (0) | — | — · — · — |
| SideNavItem | 77.0 kB (+92 B) · 11.9 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 82.3 kB (+90 B) · 12.1 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 82.3 kB (+88 B) · 12.1 kB CSS (0) | — | — · — · — |
| ComplexSelector | 77.7 kB (+86 B) · 12.6 kB CSS (0) | — | — · — · — |
| SideNavHeading | 82.6 kB (+83 B) · 12.1 kB CSS (0) | — | — · — · — |
| Typeahead | 88.0 kB (+81 B) · 13.5 kB CSS (0) | — | — · — · — |
| SegmentedControl | 102.2 kB (+76 B) · 6.9 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 76.2 kB (+73 B) · 12.6 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 113.7 kB (+73 B) · 773 B CSS (0) | — | — · — · — |
| Popover · Storybook | 98.7 kB (+72 B) · 15.1 kB CSS (0) | 1,552 (+3) | ✓ · ✓ · ✓ |
| lab/ListInput | 93.6 kB (+69 B) · 922 B CSS (0) | — | — · — · — |
| TimeInput | 174.8 kB (+68 B) · 16.9 kB CSS (0) | — | — · — · — |
| TopNavMenu | 81.6 kB (+65 B) · 12.0 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 88.6 kB (+62 B) · 372 B CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 299.7 kB (+60 B) · 454 B CSS (0) | — | — · — · — |
| BaseTypeahead | 78.4 kB (+58 B) · 11.7 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 102.0 kB (+57 B) · 1.8 kB CSS (0) | — | — · — · — |
| Tokenizer | 104.3 kB (+56 B) · 20.3 kB CSS (0) | — | — · — · — |
| Toast | 103.6 kB (+55 B) · 11.1 kB CSS (0) | — | — · — · — |
| lab/TransferList | 112.2 kB (+55 B) · 1.2 kB CSS (0) | — | — · — · — |
| DateRangeInput | 99.3 kB (+54 B) · 13.3 kB CSS (0) | — | — · — · — |
| TopNavHeading | 82.2 kB (+53 B) · 12.0 kB CSS (0) | — | — · — · — |
| lab/Schedule | 114.7 kB (+53 B) · 3.9 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 68.8 kB (+53 B) · 162 B CSS (0) | — | — · — · — |
| ToggleButton | 92.1 kB (+52 B) · 10.9 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 215.1 kB (+49 B) · 451 B CSS (0) | — | — · — · — |
| SideNav | 121.3 kB (+49 B) · 12.2 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 114.8 kB (+49 B) · 1.1 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 305.6 kB (+48 B) · 2.6 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 97.0 kB (+47 B) · 13.3 kB CSS (0) | — | — · — · — |
| TabMenu | 78.9 kB (+47 B) · 11.9 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 93.2 kB (+47 B) · 2.1 kB CSS (0) | — | — · — · — |
| DateTimeInput | 223.5 kB (+46 B) · 19.7 kB CSS (0) | — | — · — · — |
| CodeBlock | 80.2 kB (+45 B) · 12.1 kB CSS (0) | — | — · — · — |
| DateInput | 200.1 kB (+45 B) · 17.9 kB CSS (0) | — | — · — · — |
| ListItem | 79.1 kB (+45 B) · 12.0 kB CSS (0) | — | — · — · — |
| Carousel | 74.8 kB (+44 B) · 11.7 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 65.6 kB (+44 B) · 11.0 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.4 kB (+44 B) · 5.8 kB CSS (0) | — | — · — · — |
| TabList | 47.3 kB (+44 B) · 6.5 kB CSS (0) | — | — · — · — |
| ChatLayout | 88.3 kB (+43 B) · 11.3 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 79.9 kB (+43 B) · 12.0 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 52.0 kB (+42 B) · 5.7 kB CSS (0) | — | — · — · — |
| CheckboxInput | 69.0 kB (+42 B) · 10.1 kB CSS (0) | — | — · — · — |
| NumberInput | 77.6 kB (+42 B) · 12.2 kB CSS (0) | — | — · — · — |
| TextArea | 66.9 kB (+42 B) · 9.4 kB CSS (0) | — | — · — · — |
| Toolbar | 47.1 kB (+42 B) · 8.1 kB CSS (0) | — | — · — · — |
| ChatComposer | 84.6 kB (+41 B) · 12.9 kB CSS (0) | — | — · — · — |
| Lightbox | 146.0 kB (+40 B) · 11.9 kB CSS (0) | — | — · — · — |
| Button | 65.0 kB (+39 B) · 10.8 kB CSS (0) | — | — · — · — |
| FileInput | 74.2 kB (+39 B) · 11.7 kB CSS (0) | — | — · — · — |
| IconButton | 65.1 kB (+39 B) · 10.8 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 65.9 kB (+39 B) · 10.8 kB CSS (0) | — | — · — · — |
| Stepper | 66.7 kB (+39 B) · 10.9 kB CSS (0) | — | — · — · — |
| lab/TourStep | 93.3 kB (+39 B) · 691 B CSS (0) | — | — · — · — |
| InputGroup | 61.1 kB (+38 B) · 7.9 kB CSS (0) | — | — · — · — |
| PowerSearch | 306.9 kB (+38 B) · 25.5 kB CSS (0) | — | — · — · — |
| TextInput | 72.8 kB (+38 B) · 12.0 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 173.6 kB (+38 B) · 1.9 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 282.2 kB (+38 B) · 2.3 kB CSS (0) | — | — · — · — |
| RadioList | 60.8 kB (+37 B) · 7.3 kB CSS (0) | — | — · — · — |
| Avatar | 46.0 kB (+36 B) · 5.7 kB CSS (0) | — | — · — · — |
| Switch | 109.0 kB (+36 B) · 10.0 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 121.1 kB (+36 B) · 1.4 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 65.4 kB (+34 B) · 10.8 kB CSS (0) | — | — · — · — |
| Banner | 67.0 kB (+33 B) · 11.3 kB CSS (0) | — | — · — · — |
| MobileNav | 76.3 kB (+33 B) · 11.4 kB CSS (0) | — | — · — · — |
| RadioListItem | 76.1 kB (+33 B) · 10.7 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.4 kB (+33 B) · 1.2 kB CSS (0) | — | — · — · — |
| Calendar | 76.1 kB (+32 B) · 11.4 kB CSS (0) | — | — · — · — |
| ChatSendButton | 65.4 kB (+32 B) · 10.8 kB CSS (0) | — | — · — · — |
| Field | 59.5 kB (+32 B) · 7.3 kB CSS (0) | — | — · — · — |
| Thumbnail | 69.4 kB (+32 B) · 12.3 kB CSS (0) | — | — · — · — |
| Tooltip | 32.2 kB (+32 B) · 4.5 kB CSS (0) | — | — · — · — |
| TopNav | 78.0 kB (+32 B) · 11.7 kB CSS (0) | — | — · — · — |
| AvatarGroup | 48.7 kB (+31 B) · 5.8 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 65.6 kB (+31 B) · 10.8 kB CSS (0) | — | — · — · — |
| DrawerHeader | 68.0 kB (+31 B) · 13.7 kB CSS (0) | — | — · — · — |
| DialogHeader | 67.9 kB (+30 B) · 12.3 kB CSS (0) | — | — · — · — |
| Table | 120.2 kB (+29 B) · 19.6 kB CSS (0) | — | — · — · — |
| charts/Chart | 237.9 kB (+28 B) · 516 B CSS (0) | — | — · — · — |
| ContextMenu | 102.0 kB (+28 B) · 18.7 kB CSS (0) | — | — · — · — |
| Markdown | 202.7 kB (+28 B) · 21.9 kB CSS (0) | — | — · — · — |
| CheckboxList | 73.1 kB (+27 B) · 7.8 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 103.0 kB (+27 B) · 18.9 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 75.3 kB (+27 B) · 14.0 kB CSS (0) | — | — · — · — |
| Selector | 112.9 kB (+26 B) · 18.6 kB CSS (0) | — | — · — · — |
| AlertDialog | 128.7 kB (+25 B) · 15.4 kB CSS (0) | — | — · — · — |
| InfoTip | 50.4 kB (+25 B) · 5.4 kB CSS (0) | — | — · — · — |
| Link | 56.4 kB (+24 B) · 7.1 kB CSS (0) | — | — · — · — |
| TableCell | 103.3 kB (+24 B) · 19.1 kB CSS (0) | — | — · — · — |
| AppShell | 97.6 kB (+23 B) · 14.3 kB CSS (0) | — | — · — · — |
| Pagination | 123.8 kB (+23 B) · 19.0 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 92.4 kB (+21 B) · 751 B CSS (0) | — | — · — · — |
| MultiSelector | 101.5 kB (+20 B) · 17.7 kB CSS (0) | — | — · — · — |
| Slider | 114.5 kB (+15 B) · 8.9 kB CSS (0) | — | — · — · — |
| StatusDot | 33.8 kB (+11 B) · 5.4 kB CSS (0) | — | — · — · — |
| HoverCard | 30.2 kB (+6 B) · 4.5 kB CSS (0) | — | — · — · — |
| ChatMessageList | 27.4 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 31.6 kB (0) · 8.4 kB CSS (0) | — | — · — · — |
| CommandPalette | 77.9 kB (0) · 12.7 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 35.4 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.9 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| Text | 11.0 kB (0) · 5.5 kB CSS (0) | — | — · — · — |
| Timer | 13.1 kB (0) · 6.1 kB CSS (0) | — | — · — · — |
| lab/LineClamp | 13.5 kB (0) · 168 B CSS (0) | — | — · — · — |
| charts/ChartLegend | 40.2 kB (−1 B) · 224 B CSS (0) | — | — · — · — |
| CommandPaletteInput | 32.9 kB (−1 B) · 7.6 kB CSS (0) | — | — · — · — |
| Heading | 11.6 kB (−1 B) · 5.5 kB CSS (0) | — | — · — · — |
| Spinner | 24.0 kB (−1 B) · 6.3 kB CSS (0) | — | — · — · — |
| Timestamp | 27.0 kB (−1 B) · 11.0 kB CSS (0) | — | — · — · — |
| layer | — | — | — · ✓ · — |
| Layer | — | — | ✓ · ✓ · — |
Visual changes: 4 snapshots in 1 component
A change is a question for the reviewer, not a failure.
Inheritance checked against the 6 newest reports of other pull requests.
Package size: @astryxdesign/core 7.61 MB packed (+1.2 kB); 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 fix restores focus and onClick for an uncontrolled menu whose open waits for its anchor, but it introduces one regression for controlled menus.
- Blocking: the new controlled-close branch in
DropdownMenu.tsx(lines 1229-1233) runs on every render, becausepopoveris a new object each render, so a controlled menu (isMenuOpenwithonOpenChange) that re-renders while its trigger open waits is hidden and never opens, where the base still opened it; guard it with&& !pendingControlledOpenRef.currentand add a controlled case that re-renders the parent during the wait toDropdownMenuPendingOpen.test.tsx.
With that guard applied, a controlled copy of your unit harness opens with the menu focused and onClick called once, ArrowDown lands on the first row, and your tests and DropdownMenu.test.tsx still pass. The new unit cases fail on the base and pass on this head, and the published API surface is unchanged. CI has not run on this draft head yet.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Changeset: a menu whose layer opens once its trigger is a valid anchor now takes focus and fires
onClickonce. Verified for uncontrolled menus by the new unit cases; false for a controlled menu that re-renders while the open waits (the blocking finding). - Changeset: in a closed dialog the page displays, the layer opens one commit after the press. Verified in
useLayer.tsx(the next-commit decision) and the shared resize observer's call on registration. - Changeset and description: the base read that open as refused, so focus stayed on the trigger and
onClicknever fired. Verified in the base'sopenAndFocus; the new unit cases fail on the base. - Description: the layer reports a waiting show through an internal option that
usePopoverpasses through. Verified (useLayer.tsx487, 1749-1771, 1932-1935;usePopover.tsx563, 579). - Description: focus and the click stay armed while the open waits, and a hide or a real refusal clears them. Verified for
closeMenuand the disabled-trigger refusal; the controlled-close branch also fires when nothing closed the menu (the blocking finding). - Description: a pointer open focuses the menu and fires
onClickonce; Enter lands on the first row and ArrowUp on the last. Verified by the unit cases; the browser spec was not run here. - Description: a menu outside any dialog opens at once and its suites pass. Verified: the DropdownMenu, Layer, Popover, MoreMenu and Tooltip unit suites pass on this head.
- Description: without the fix the new cases fail. Verified for the unit cases; not run for the browser cases.
- Description: no public API change; internal options only. Verified: the built Core and theme surfaces compare with no added, changed or removed rows.
- Description: size +390/-21 (source +77/-21, tests +272, stories +34, changeset +7). Verified.
- Description: bundle and reference-page gzip deltas. Reported; not re-measured.
- Description: ESLint, Prettier and typecheck pass. Verified for ESLint and Prettier on the changed files and the Core typecheck.
Files:
.changeset/dropdown-menu-pending-open.md: its claim fails for controlled menus until the blocking finding is fixed.apps/storybook/stories/DropdownMenu.stories.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.tsx: blocking finding at lines 1229-1233.packages/core/src/DropdownMenu/DropdownMenuPendingOpen.test.tsx: clear; it covers only uncontrolled menus.packages/core/src/DropdownMenu/__tests__/DropdownMenuPendingOpen.a11y.browser.spec.ts: clear; not run here.packages/core/src/Layer/useLayer.tsx: clear.packages/core/src/Popover/usePopover.tsx: clear.
|
/approve-spec df45115 |
There was a problem hiding this comment.
Changes requested: the fix restores focus and onClick for an uncontrolled menu whose open waits for its anchor, but the one regression for controlled menus is still there.
- Blocking: the controlled-close branch in
DropdownMenu.tsx(lines 1244-1248) runs on every render, becausepopoveris a new object each render, so a controlled menu (isMenuOpenwithonOpenChange) that re-renders while its trigger open waits is hidden and never opens, where the base still opened it; guard it with&& !pendingControlledOpenRef.currentand add a controlled case that re-renders the parent during the wait toDropdownMenuPendingOpen.test.tsx.
With that guard, a controlled copy of your unit harness opens with the menu focused and onClick called once, ArrowDown lands on the first row, and your tests and DropdownMenu.test.tsx still pass. Your new unit cases fail on the base and pass on this head, the DropdownMenu, Layer, Popover, MoreMenu and Tooltip suites pass, and the published API surface is unchanged. CI's heavy jobs have not run on this draft head yet.
Claims and files checked
Review mode: same-head; reason: none
Claims:
- Changeset: a menu whose layer opens once its trigger is a valid anchor now takes focus and fires
onClickonce. Verified for uncontrolled menus by the new unit cases; false for a controlled menu that re-renders while the open waits (the blocking finding). - Changeset: in a closed dialog the page displays, the layer opens one commit after the press. Verified in
useLayer.tsx(the next-commit decision). - Changeset and description: the base read that open as refused, so focus stayed on the trigger and
onClicknever fired. Verified: the new unit cases fail on the base. - Description: an open whose trigger gets its box during an ancestor's entrance had the same problem. Verified by the new unit harness.
- Description: the layer reports a waiting show through an internal option that
usePopoverpasses through. Verified (useLayer.tsx515, 1748-1771, 1932-1935;usePopover.tsx410, 531). - Description: focus and the click stay armed while the open waits, and a hide or a real refusal clears them. Verified for
closeMenuand the disabled-trigger refusal; the controlled-close branch also fires when nothing closed the menu (the blocking finding). - Description: a pointer open focuses the menu and fires
onClickonce; Enter lands on the first row and ArrowUp on the last. Verified by the unit cases and by Chromium captures of the new story; the browser spec itself was not run here. - Description: a menu outside any dialog opens at once and its suites pass. Verified: the DropdownMenu, Layer, Popover, MoreMenu and Tooltip unit suites pass on this head.
- Description: without the fix the new cases fail. Verified for the unit cases; not run for the browser cases.
- Description: no public API change; internal options only. Verified: the built Core and theme surfaces compare with no added, changed or removed rows.
- Description: size +390/-21 (source +77/-21, tests +272, stories +34, changeset +7). Verified.
- Description: bundle and reference-page gzip deltas. Reported; not re-measured.
- Description: ESLint, Prettier and typecheck pass. Verified for ESLint and Prettier on the changed files and the Core typecheck.
- Description: the latest commit merges
mainwith this pull request's own lines unchanged. Verified: a clean merge, and the pull request's patch is identical.
Files:
.changeset/dropdown-menu-pending-open.md: its claim fails for controlled menus until the blocking finding is fixed.apps/storybook/stories/DropdownMenu.stories.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.tsx: blocking finding at lines 1244-1248.packages/core/src/DropdownMenu/DropdownMenuPendingOpen.test.tsx: clear; it covers only uncontrolled menus.packages/core/src/DropdownMenu/__tests__/DropdownMenuPendingOpen.a11y.browser.spec.ts: clear; not run here.packages/core/src/Layer/useLayer.tsx: clear.packages/core/src/Popover/usePopover.tsx: clear.
The controlled-close branch ran on every render of a controlled menu, because the popover object changes each render. A trigger open waits for the controller to hear of it, so isMenuOpen is still false then, and a render in that window hid the open the person asked for. The branch now skips a trigger open that the controller has not heard of yet. A unit case renders the parent again while the open waits.
|
/approve-spec 87330c3 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this draft head yet; marking the pull request ready for review starts it.
The controlled-menu regression from the last review is fixed: the new guard keeps a trigger open that the controller has not heard of yet, and your new controlled case fails without it. A waiting open in a closed in-flow <dialog> now focuses the menu and calls onClick once, and Enter and ArrowUp land on the first and last rows in Chromium. The published API surface is unchanged.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Changeset: a menu whose layer opens once its trigger is a valid anchor now takes focus as it opens and fires
onClickonce. Verified by the three new unit cases (one controlled) and by Chromium captures of the new story. - Changeset: in a native dialog the page displays closed, the layer opens one commit after the press. Verified in
useLayer.tsx(the next-commit decision, lines 1880-1895). - Changeset and description: the base read that open as refused, so focus stayed on the trigger and
onClicknever fired. Verified: in Chromium the base leaves focus on the trigger with the click counter at 0, and the new unit cases fail on the base. - Description: a keyboard open on the base lands on no row. Verified in Chromium (Enter and ArrowUp leave focus on the trigger).
- Description: a trigger that gets its box while an ancestor plays its entrance had the same problem. Verified by the unit harness, which fails on the base.
- Description:
openAndFocusreads at once whether the layer reported the open. Verified in the base source. - Description: the layer reports when an accepted show starts and stops waiting, through an internal option that
usePopoverpasses through. Verified (useLayer.tsx515, 1748-1771, 1932-1935;usePopover.tsx410, 531). - Description: focus and the click stay armed while the open waits, and a hide or a real refusal clears them. Verified (
closeMenu, the disabled-trigger refusal, the refused path, and the controlled close). - Description: a pointer open focuses the menu and fires
onClickonce; Enter lands on the first row and ArrowUp on the last. Verified in Chromium and by the unit cases. - Description: the owners ruled this a defect repair. Verified: an engineering owner approved this exact head.
- Description: the latest commit keeps a controlled menu's open when its parent renders during the wait, and its new case fails without it. Verified.
- Description: a menu outside any dialog opens at once and its unit suites pass. Verified: the DropdownMenu, Layer, Popover, MoreMenu and Tooltip suites pass.
- Description: no public API change; internal options only. Verified: the built Core and theme surfaces compare with no added, changed or removed rows.
- Description: size +436/-21 (source +79/-21, tests +316, stories +34, changeset +7). Verified.
- Description: bundle and reference-page gzip deltas. Reported; not re-measured.
- Description: ESLint, Prettier and typecheck pass. Verified for ESLint and Prettier on the changed files and the Core typecheck.
- Description: WebKit results and the browser and accessibility spec runs. Reported; not run here (Chromium captures cover the new story).
- Description: test runs at a commit that is not in this pull request's history. Not verifiable; superseded by the runs above.
- Description: the merge of
mainleaves this pull request's own lines unchanged. Verified: the patch from the merge base is the same apart from the latest commit.
Files:
.changeset/dropdown-menu-pending-open.md: clear.apps/storybook/stories/DropdownMenu.stories.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.tsx: clear; the controlled-close guard at line 1244 fixes the earlier finding.packages/core/src/DropdownMenu/DropdownMenuPendingOpen.test.tsx: clear; it now covers a controlled menu.packages/core/src/DropdownMenu/__tests__/DropdownMenuPendingOpen.a11y.browser.spec.ts: clear; not run here.packages/core/src/Layer/useLayer.tsx: clear.packages/core/src/Popover/usePopover.tsx: clear.
|
/approve-spec ee52676 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this draft head yet; marking the pull request ready for review starts it.
The head only merges main: the waiting-open cases still fail on the base and pass here, the merged useLayer change keeps the closed-dialog checks' result, and the published API surface is unchanged. A waiting open in a closed in-flow <dialog> focuses the menu and calls onClick once, and Enter and ArrowUp land on the first and last rows in Chromium.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Changeset: a menu whose layer opens once its trigger is a valid anchor now takes focus as it opens and fires
onClickonce. Verified by the three new unit cases and by Chromium captures of the new story. - Changeset: in a native dialog the page displays closed, the layer opens one commit after the press. Verified in
useLayer.tsx(the next-commit decision, lines 1870-1885). - Changeset and description: the base read that open as refused, so focus stayed on the trigger and
onClicknever fired. Verified: in Chromium the base leaves focus on the trigger with the click counter at 0, and the new unit cases fail on the base. - Description: a keyboard open on the base lands on no row. Verified in Chromium (Enter and ArrowUp leave focus on the trigger).
- Description: a trigger that gets its box while an ancestor plays its entrance had the same problem. Verified by the unit harness, which fails on the base.
- Description:
openAndFocusreads at once whether the layer reported the open. Verified in the base source. - Description: the layer reports when an accepted show starts and stops waiting, through an internal option that
usePopoverpasses through. Verified (useLayer.tsx515, 1747-1760, 1922-1925;usePopover.tsx410, 531). - Description: focus and the click stay armed while the open waits, and a hide or a real refusal clears them. Verified (
closeMenu, the disabled-trigger refusal, the refused path, and the controlled close atDropdownMenu.tsx:1244). - Description: a pointer open focuses the menu and fires
onClickonce; Enter lands on the first row and ArrowUp on the last. Verified in Chromium and by the unit cases. - Description: the owners ruled this a defect repair. Verified: an engineering owner approved this exact head.
- Description: a controlled menu keeps its open when its parent renders during the wait. Verified: that case passes here and fails on the base.
- Description: a menu outside any dialog opens at once and its unit suites pass. Verified: the DropdownMenu, Layer, Popover, MoreMenu, Tooltip and focus-trap suites pass.
- Description: without the fix the new unit cases fail. Verified on the base.
- Description: no public API change; internal options only. Verified: the built Core and theme surfaces compare with no added, changed or removed rows.
- Description: size +436/-21 (source +79/-21, tests +316, stories +34, changeset +7). Verified.
- Description: bundle and reference-page gzip deltas. Reported; they match CI's size report for the previous commit; not re-measured.
- Description: ESLint, Prettier, the changeset check and typecheck pass. ESLint and Prettier verified on the changed files, and the Core build's type step passes; the changeset check and the full typecheck were not run here.
- Description: both merges of
mainleave this pull request's own lines unchanged. Verified: the patch is the same apart from line offsets, and the latest merge is a clean automatic merge. - Description: browser spec, WebKit and unit-count results at several commits. Reported; not run here (Chromium captures cover the new story).
- Description: test runs at a commit that is not in this pull request's history. Not verifiable.
Files:
.changeset/dropdown-menu-pending-open.md: clear.apps/storybook/stories/DropdownMenu.stories.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.tsx: clear; the controlled-close guard at line 1244 still holds.packages/core/src/DropdownMenu/DropdownMenuPendingOpen.test.tsx: clear.packages/core/src/DropdownMenu/__tests__/DropdownMenuPendingOpen.a11y.browser.spec.ts: clear; not run here.packages/core/src/Layer/useLayer.tsx: clear; the merged closed-dialog refactor keeps its result.packages/core/src/Popover/usePopover.tsx: clear.












User impact
A
DropdownMenuin a native<dialog>that the page displays closed opens on a press, but focus stays on the trigger andonClicknever fires. A keyboard open lands on no row. A menu whose trigger gets its box while an ancestor plays its entrance does the same.Problem and solution fit
openAndFocuscalls the popover'sshow(), then reads at once whether the layer reported the open.The layer can accept a show and hold it until the trigger is a valid anchor. In a closed dialog that the page displays, #11864 opens it one commit later, still within the press.
The menu read that held open as refused, and cleared the focus and the click it had armed.
Expected behavior and authority
A pointer open focuses the menu, and a keyboard open lands on its first row, or its last for ArrowUp. A pointer open fires
onClickonce. The owners ruled this a defect repair.Smallest restoration
onOpenPendingChange, whichusePopoverpasses through.DropdownMenukeeps its focus and click armed while the open waits. A hide, or a real refusal, clears them.Evidence
onClickdoes not fire, in Chromium and in WebKit.onClickonce. Enter lands on the first row, and ArrowUp on the last.Scope
Components: DropdownMenu, Layer, Popover
Public and internal API delta
None public. Internal:
useLayer's internal options gainonOpenPendingChange, andusePopover's internal options pass it through.DropdownMenu+126 B,MoreMenu+141,Popover+61,Tooltip+30. INV10 pages: docs +57 B, form +43, menu +109, table +24.Testing
The runs below are at eefe423, on Storybook builds made at that head and stamped with
git rev-parse HEAD. 2ecf502 changes only a comment inDropdownMenuPendingOpen.test.tsxand the commit subject.uiproject passes all 25,875 tests in 1,039 files.check:changesetspass. Typecheck passes in every package. At 2ecf502,review:prereports 411 authored lines and 0 findings.anchorReadinesspass in Chromium (13) and in WebKit (13), and theDropdownMenu,PopoveranduseLayersuites pass 704 of 704.anchorReadinessandMenuHeaderFooterpass in Chromium (23), and the first two in WebKit (13). DropdownMenu's interaction specs pass 26 tests, and 28 unit files pass 857 tests.anchorReadiness,focusInClosedDialogandMenuHeaderFooterpass in Chromium (26), and the first three in WebKit (15, 1 skipped). 26 unit files pass 909 tests,Pagination.test.tsxamong them.test-ui (4/4)at 87330c3 failed Pagination's late-page case, a timing race in that test. test(Pagination): settle the change action before the late-page check #11920 fixes the test; this pull request does not touch Pagination.