Skip to content

fix(DropdownMenu): a waiting open still takes focus and fires onClick - #11905

Merged
cixzhang merged 4 commits into
meta:mainfrom
vjeux:fix/dropdown-menu-pending-open
Nov 16, 2026
Merged

cixzhang merged 4 commits into
meta:mainfrom
vjeux:fix/dropdown-menu-pending-open

Conversation

@vjeux

@vjeux vjeux commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A DropdownMenu in a native <dialog> that the page displays closed opens on a press, but focus stays on the trigger and onClick never 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

openAndFocus calls the popover's show(), 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 onClick once. The owners ruled this a defect repair.

Smallest restoration

  • The layer tells its owner when a show that it accepted starts to wait, and when the wait ends. It is an internal option, onOpenPendingChange, which usePopover passes through.
  • DropdownMenu keeps its focus and click armed while the open waits. A hide, or a real refusal, clears them.

Evidence

  • Reproduction before the change: in a displayed closed dialog, a click opens the menu with focus left on the trigger. onClick does not fire, in Chromium and in WebKit.
  • Result after the change: the click focuses the menu and fires onClick once. Enter lands on the first row, and ArrowUp on the last.
  • Representative unchanged path: a menu outside any dialog opens at once, as before. Its unit suites pass unchanged.
  • Regression test or other mutation-sensitive proof: without the fix, the new browser cases and the new unit cases fail.

Scope

Components: DropdownMenu, Layer, Popover

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Public and internal API delta

None public. Internal: useLayer's internal options gain onOpenPendingChange, and usePopover's internal options pass it through.

  • Size: +436/−21 lines (344ec5b..87330c3): source +79/−21, tests +316, stories +34, changeset +7. Of 123 measured imports, 107 change by −1 to +141 B gzip, with no CSS change. 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 in DropdownMenuPendingOpen.test.tsx and the commit subject.

  • Red first. With only the three source files at main's, the 2 browser cases fail in Chromium and in WebKit. The 2 unit cases fail too.
  • Green. The browser cases pass 2 of 2 in each engine, and the unit cases pass 2 of 2. At 2ecf502, that unit file passes 2 of 2 again.
  • Unit tests. The ui project passes all 25,875 tests in 1,039 files.
  • Accessibility selection. CI's selection picks 48 specs, and they pass in Chromium: 320 tests. Its 9 cross-browser specs pass in WebKit: 32 tests.
  • Interaction, Chromium. 19 specs of Layer, Popover, DropdownMenu and Tooltip pass: 159 tests, with 9 skipped.
  • Checks. ESLint with no warnings, Prettier and check:changesets pass. Typecheck passes in every package. At 2ecf502, review:pre reports 411 authored lines and 0 findings.
  • After the main merge. df45115 merges main 344ec5b, with this pull request's own lines unchanged. At df45115, this spec and anchorReadiness pass in Chromium (13) and in WebKit (13), and the DropdownMenu, Popover and useLayer suites pass 704 of 704.
  • A controlled menu. 87330c3 keeps a controlled menu's open when its parent renders again during the wait. Its new unit case fails at df45115 and passes here. At 87330c3, this spec, anchorReadiness and MenuHeaderFooter pass in Chromium (23), and the first two in WebKit (13). DropdownMenu's interaction specs pass 26 tests, and 28 unit files pass 857 tests.
  • After the second main merge. ee52676 merges main 4213897, which carries fix(useFocusTrap): Tab stops inside a closed dialog the page displays #11892, with this pull request's own lines unchanged. At ee52676, this spec, anchorReadiness, focusInClosedDialog and MenuHeaderFooter pass in Chromium (26), and the first three in WebKit (15, 1 skipped). 26 unit files pass 909 tests, Pagination.test.tsx among them.
  • CI at 87330c3. CI's 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.

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.
@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 15, 2026 8:13pm 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 15, 2026, 8:23 PM UTC

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 2ecf502

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ee52676

Storybook · Sandbox · built from this PR's head

Modified components

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.

Component · story Before After Diff
DropdownMenu · Lab Checkbox Items (probe, dark) · inheritance unknown: not found in the 6 newest reports of other pull requests before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (probe, light) · inheritance unknown: not found in the 6 newest reports of other pull requests before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (neutral, dark) · inheritance unknown: not found in the 6 newest reports of other pull requests before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (neutral, light) · inheritance unknown: not found in the 6 newest reports of other pull requests before frame after frame diff frame

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

@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 15, 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.

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, because popover is a new object each render, so a controlled menu (isMenuOpen with onOpenChange) that re-renders while its trigger open waits is hidden and never opens, where the base still opened it; guard it with && !pendingControlledOpenRef.current and add a controlled case that re-renders the parent during the wait to DropdownMenuPendingOpen.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 onClick once. 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 onClick never fired. Verified in the base's openAndFocus; the new unit cases fail on the base.
  • Description: the layer reports a waiting show through an internal option that usePopover passes through. Verified (useLayer.tsx 487, 1749-1771, 1932-1935; usePopover.tsx 563, 579).
  • Description: focus and the click stay armed while the open waits, and a hide or a real refusal clears them. Verified for closeMenu and 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 onClick once; 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.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec df45115

@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 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, because popover is a new object each render, so a controlled menu (isMenuOpen with onOpenChange) that re-renders while its trigger open waits is hidden and never opens, where the base still opened it; guard it with && !pendingControlledOpenRef.current and add a controlled case that re-renders the parent during the wait to DropdownMenuPendingOpen.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 onClick once. 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 onClick never 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 usePopover passes through. Verified (useLayer.tsx 515, 1748-1771, 1932-1935; usePopover.tsx 410, 531).
  • Description: focus and the click stay armed while the open waits, and a hide or a real refusal clears them. Verified for closeMenu and 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 onClick once; 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 main with 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.

Automated review (maintainer link)

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

Copy link
Copy Markdown
Contributor

/approve-spec 87330c3

@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 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 onClick once. 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 onClick never 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: openAndFocus reads 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 usePopover passes through. Verified (useLayer.tsx 515, 1748-1771, 1932-1935; usePopover.tsx 410, 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 onClick once; 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 main leaves 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.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 15, 2026 18:57
@vjeux
vjeux marked this pull request as draft November 15, 2026 19:53
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec ee52676

@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 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 onClick once. 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 onClick never 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: openAndFocus reads 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 usePopover passes through. Verified (useLayer.tsx 515, 1747-1760, 1922-1925; usePopover.tsx 410, 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 at DropdownMenu.tsx:1244).
  • Description: a pointer open focuses the menu and fires onClick once; 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 main leave 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.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 15, 2026 20:27
@vjeux
vjeux marked this pull request as draft November 15, 2026 21:49
@vjeux
vjeux marked this pull request as ready for review November 15, 2026 21:49
@vjeux
vjeux marked this pull request as draft November 15, 2026 22:04
@vjeux
vjeux marked this pull request as ready for review November 15, 2026 22:04
@vjeux
vjeux marked this pull request as draft November 16, 2026 00:44
@vjeux
vjeux marked this pull request as ready for review November 16, 2026 00:44
@vjeux
vjeux marked this pull request as draft November 16, 2026 01:02
@vjeux
vjeux marked this pull request as ready for review November 16, 2026 01:02
github-actions Bot added a commit that referenced this pull request Nov 16, 2026
@cixzhang
cixzhang merged commit 5a24fc0 into meta:main Nov 16, 2026
370 of 423 checks passed
@vjeux
vjeux deleted the fix/dropdown-menu-pending-open branch November 16, 2026 02:10

This branch was successfully deployed

1 active deployment
Preview — ee526766 Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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.

2 participants