Repository navigation
fix(DropdownMenu): a mouse press opens a menu in another document - #11938
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DropdownMenuSubMenu | 78.6 kB (+90 B) · 10.5 kB CSS (0) | — | ✗ · ✓ · ✓ |
| DropdownMenu | 107.6 kB (+89 B) · 18.9 kB CSS (0) | — | ✗ · ✓ · ✓ |
| DropdownMenuCheckboxItem | 28.6 kB (0) · 7.3 kB CSS (0) | — | ✗ · ✓ · ✓ |
123 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) | — | ✓ · ✓ · ✗ |
| Field | 59.6 kB (+95 B) · 7.3 kB CSS (0) | — | — · — · — |
| Thumbnail | 69.5 kB (+95 B) · 12.4 kB CSS (0) | — | — · — · — |
| TextInput | 72.9 kB (+93 B) · 12.0 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 78.6 kB (+92 B) · 11.7 kB CSS (0) | — | — · — · — |
| Slider | 114.6 kB (+91 B) · 8.9 kB CSS (0) | — | — · — · — |
| Switch | 109.1 kB (+88 B) · 10.0 kB CSS (0) | — | — · — · — |
| TabList | 47.4 kB (+88 B) · 6.5 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 80.1 kB (+87 B) · 12.1 kB CSS (0) | — | — · — · — |
| ListItem | 79.2 kB (+87 B) · 12.1 kB CSS (0) | — | — · — · — |
| TopNav | 78.2 kB (+87 B) · 11.8 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 92.6 kB (+87 B) · 751 B CSS (0) | — | — · — · — |
| Stepper | 66.8 kB (+86 B) · 10.9 kB CSS (0) | — | — · — · — |
| AlertDialog | 128.9 kB (+85 B) · 15.5 kB CSS (0) | — | — · — · — |
| AppShell | 97.8 kB (+85 B) · 14.4 kB CSS (0) | — | — · — · — |
| MobileNav | 76.4 kB (+85 B) · 11.4 kB CSS (0) | — | — · — · — |
| ToggleButton | 92.2 kB (+84 B) · 10.9 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 93.3 kB (+84 B) · 2.1 kB CSS (0) | — | — · — · — |
| DateRangeInput | 99.5 kB (+83 B) · 13.3 kB CSS (0) | — | — · — · — |
| CodeBlock | 80.6 kB (+81 B) · 12.1 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.5 kB (+81 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 88.8 kB (+81 B) · 372 B CSS (0) | — | — · — · — |
| AvatarGroup | 48.9 kB (+80 B) · 5.8 kB CSS (0) | — | — · — · — |
| HoverCard | 30.4 kB (+79 B) · 4.5 kB CSS (0) | — | — · — · — |
| MoreMenu | 107.8 kB (+79 B) · 18.9 kB CSS (0) | — | — · — · — |
| Toolbar | 47.3 kB (+79 B) · 8.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 299.8 kB (+79 B) · 454 B CSS (0) | — | — · — · — |
| NumberInput | 77.7 kB (+78 B) · 12.2 kB CSS (0) | — | — · — · — |
| CheckboxInput | 69.1 kB (+77 B) · 10.2 kB CSS (0) | — | — · — · — |
| FileInput | 74.3 kB (+77 B) · 11.7 kB CSS (0) | — | — · — · — |
| MultiSelector | 101.6 kB (+77 B) · 17.8 kB CSS (0) | — | — · — · — |
| StatusDot | 33.9 kB (+77 B) · 5.4 kB CSS (0) | — | — · — · — |
| Pagination | 124.0 kB (+76 B) · 19.1 kB CSS (0) | — | — · — · — |
| Selector | 113.0 kB (+76 B) · 18.7 kB CSS (0) | — | — · — · — |
| lab/TourStep | 93.4 kB (+76 B) · 691 B CSS (0) | — | — · — · — |
| Tokenizer | 104.4 kB (+75 B) · 20.4 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 52.1 kB (+74 B) · 5.7 kB CSS (0) | — | — · — · — |
| ContextMenu | 102.2 kB (+74 B) · 18.8 kB CSS (0) | — | — · — · — |
| TableCell | 103.4 kB (+74 B) · 19.2 kB CSS (0) | — | — · — · — |
| Table | 120.3 kB (+73 B) · 19.7 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 103.1 kB (+73 B) · 19.0 kB CSS (0) | — | — · — · — |
| lab/ListInput | 93.7 kB (+73 B) · 922 B CSS (0) | — | — · — · — |
| lab/Schedule | 114.8 kB (+73 B) · 3.9 kB CSS (0) | — | — · — · — |
| ChatComposer | 84.7 kB (+72 B) · 12.9 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 33.0 kB (+72 B) · 7.6 kB CSS (0) | — | — · — · — |
| Markdown | 203.1 kB (+72 B) · 22.0 kB CSS (0) | — | — · — · — |
| RadioList | 60.9 kB (+72 B) · 7.4 kB CSS (0) | — | — · — · — |
| TopNavMenu | 81.7 kB (+72 B) · 12.0 kB CSS (0) | — | — · — · — |
| Carousel | 74.8 kB (+71 B) · 11.7 kB CSS (0) | — | — · — · — |
| InputGroup | 61.2 kB (+71 B) · 7.9 kB CSS (0) | — | — · — · — |
| RadioListItem | 76.2 kB (+71 B) · 10.7 kB CSS (0) | — | — · — · — |
| Timestamp | 27.0 kB (+71 B) · 11.1 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 97.1 kB (+70 B) · 13.3 kB CSS (0) | — | — · — · — |
| ChatMessageList | 27.4 kB (+70 B) · 7.1 kB CSS (0) | — | — · — · — |
| Link | 56.5 kB (+70 B) · 7.1 kB CSS (0) | — | — · — · — |
| Avatar | 46.1 kB (+69 B) · 5.7 kB CSS (0) | — | — · — · — |
| Calendar | 76.2 kB (+69 B) · 11.4 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.5 kB (+69 B) · 5.8 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 113.8 kB (+69 B) · 773 B CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 69.0 kB (+69 B) · 162 B CSS (0) | — | — · — · — |
| richtext/RichTextView | 282.6 kB (+69 B) · 2.3 kB CSS (0) | — | — · — · — |
| ChatSendButton | 65.5 kB (+68 B) · 10.8 kB CSS (0) | — | — · — · — |
| ComplexSelector | 77.8 kB (+68 B) · 12.7 kB CSS (0) | — | — · — · — |
| Heading | 11.6 kB (+68 B) · 5.5 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 66.0 kB (+68 B) · 10.8 kB CSS (0) | — | — · — · — |
| TextArea | 67.0 kB (+68 B) · 9.4 kB CSS (0) | — | — · — · — |
| Tooltip | 32.2 kB (+68 B) · 4.5 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 121.2 kB (+68 B) · 1.4 kB CSS (0) | — | — · — · — |
| DateInput | 200.3 kB (+67 B) · 18.0 kB CSS (0) | — | — · — · — |
| SegmentedControl | 102.3 kB (+67 B) · 6.9 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 114.9 kB (+67 B) · 1.1 kB CSS (0) | — | — · — · — |
| charts/ChartLegend | 40.4 kB (+66 B) · 224 B CSS (0) | — | — · — · — |
| SideNav | 121.3 kB (+66 B) · 12.2 kB CSS (0) | — | — · — · — |
| Banner | 67.1 kB (+65 B) · 11.3 kB CSS (0) | — | — · — · — |
| SideNavHeading | 82.7 kB (+65 B) · 12.1 kB CSS (0) | — | — · — · — |
| TabMenu | 79.0 kB (+65 B) · 11.9 kB CSS (0) | — | — · — · — |
| Timer | 13.1 kB (+65 B) · 6.1 kB CSS (0) | — | — · — · — |
| lab/Comments | 370.5 kB (+65 B) · 2.5 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 306.0 kB (+65 B) · 2.6 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 82.4 kB (+64 B) · 12.1 kB CSS (0) | — | — · — · — |
| DialogHeader | 68.0 kB (+64 B) · 12.4 kB CSS (0) | — | — · — · — |
| InfoTip | 50.5 kB (+64 B) · 5.4 kB CSS (0) | — | — · — · — |
| Text | 11.1 kB (+64 B) · 5.5 kB CSS (0) | — | — · — · — |
| TimeInput | 175.0 kB (+64 B) · 17.0 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 82.4 kB (+63 B) · 12.1 kB CSS (0) | — | — · — · — |
| DrawerHeader | 68.2 kB (+63 B) · 13.8 kB CSS (0) | — | — · — · — |
| IconButton | 65.2 kB (+63 B) · 10.8 kB CSS (0) | — | — · — · — |
| TopNavHeading | 82.2 kB (+63 B) · 12.0 kB CSS (0) | — | — · — · — |
| Button | 65.1 kB (+62 B) · 10.8 kB CSS (0) | — | — · — · — |
| CommandPalette | 78.0 kB (+62 B) · 12.8 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 76.3 kB (+62 B) · 12.7 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 31.7 kB (+61 B) · 8.5 kB CSS (0) | — | — · — · — |
| Lightbox | 146.1 kB (+61 B) · 12.0 kB CSS (0) | — | — · — · — |
| Toast | 103.8 kB (+60 B) · 11.1 kB CSS (0) | — | — · — · — |
| lab/LineClamp | 13.6 kB (+60 B) · 168 B CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 65.7 kB (+59 B) · 11.0 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 65.4 kB (+59 B) · 10.8 kB CSS (0) | — | — · — · — |
| PowerSearch | 307.1 kB (+59 B) · 25.6 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 102.1 kB (+58 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 174.1 kB (+57 B) · 1.9 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 215.6 kB (+56 B) · 451 B CSS (0) | — | — · — · — |
| charts/Chart | 238.5 kB (+55 B) · 516 B CSS (0) | — | — · — · — |
| ChatDictationButton | 65.7 kB (+55 B) · 10.9 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 363.6 kB (+55 B) · 2.4 kB CSS (0) | — | — · — · — |
| CheckboxList | 73.2 kB (+54 B) · 7.8 kB CSS (0) | — | — · — · — |
| Popover | 98.8 kB (+54 B) · 15.2 kB CSS (0) | — | — · — · — |
| SideNavItem | 77.1 kB (+54 B) · 11.9 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 75.4 kB (+54 B) · 14.1 kB CSS (0) | — | — · — · — |
| ChatLayout | 88.4 kB (+53 B) · 11.4 kB CSS (0) | — | — · — · — |
| DateTimeInput | 223.7 kB (+53 B) · 19.8 kB CSS (0) | — | — · — · — |
| lab/TransferList | 112.3 kB (+53 B) · 1.2 kB CSS (0) | — | — · — · — |
| Spinner | 24.0 kB (+50 B) · 6.3 kB CSS (0) | — | — · — · — |
| Typeahead | 88.0 kB (+48 B) · 13.5 kB CSS (0) | — | — · — · — |
| NavHeadingMenu | 18.5 kB (+27 B) · 3.5 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.9 kB (+1 B) · 6.4 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 35.4 kB (0) · 7.1 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 5 newest reports of other pull requests.
Package size: @astryxdesign/core 7.62 MB packed (+927 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
|
/approve-spec 1cda1eb |
There was a problem hiding this comment.
Changes requested: the press-open fix works for a trigger in an iframe, but the second-document subscription has to move out of the component Effect, and one line of the description is inaccurate.
DropdownMenu.tsx:1000-1002adds a component-level Effect with never-released listeners for second-document input beside the per-node document hold the trigger already runs (useInteractionModalityTracking's ref), which the React runtime record's one-shared-owner rule (INV16) rules out: calllistenForGestures(node.ownerDocument)from the shared trigger-ref path, such as useLayer'scontextRef, and delete the Effect.- The same Effect does attach-time work with empty dependencies, so a trigger node that is replaced or moved without remounting the menu is never subscribed, while the trigger's callback ref (
DropdownMenu.tsx:1723) already runs for every node and is where that work belongs (INV2, INV3, INV6). - The description's reproduction says
onClickdoes not fire before the change, but on the base a mouse press in the iframe opens the menu and callsonClickbefore its release closes it (the story's counter reads 1), so please reword that line.
Not blocking: the close-path focus check and the settle-wait change are separate second-document fixes with no test, so consider covering or splitting them, and add the new spec to the record's verified_by list. The record's new verification row is already approved for this head.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim (changeset): a mouse press opens a menu whose trigger is in a same-origin iframe or another window, and it stays open through the release: verified in the iframe with a browser check on base and head; the Picture-in-Picture and opened-window cases rest on the pull request's own browser spec.
- Claim: before the change, a press opened the menu and its release closed it, while Enter still opened it: verified in the iframe.
- Claim: before the change,
onClickdid not fire: false; the base counter reads 1 after the click. - Claim: the counter listened only in the page's document, and both the invoker hold and the pointer claim read it: verified (
gestureCounter.tslisten,DropdownMenu.tsx:1437-1446,:1486-1491). - Claim: the claim's
instanceof HTMLElementcheck is false for another window's element: verified by reading; no test separates it, as the description says. - Claim:
listenForGestures(doc)counts indoc, a second call or the page's own document adds nothing, and neither the Layer index nor the package exports it: verified (gestureCounter.ts:180-187, the new unit test, the API generator lists no rows). - Claim: a layout effect subscribes the trigger's document at mount, and the claim and close checks work across windows: verified (
DropdownMenu.tsx:1000-1002,:1067-1072,:1489). - Claim: a portal into a new window remounts the trigger, which registers again: verified when the whole menu is portalled.
- Claim: the settle wait reads the anchor's own document, timeline and frames: verified (
useLayer.tsx:916-965). - Claim: the press model, the keyboard and menus in the page are unchanged: verified; page paths take the same branches, and Enter then Escape in the iframe is identical on base and head.
- Claim: the fix extends the shared owner as the one-shared-owner rule asks: false in part; the owner is extended, but the component also adds its own Effect.
- Claim: no new internal module, so the internal-module decision rule does not apply: verified.
- Claim: one defect is restored: partly; two more second-document restorations ride along.
- Claim: no new public API: verified with the API generator over the built packages.
- Claim: size +398/−22: verified.
- Claim: red first, the three mouse cases fail at main's sources: verified for the iframe case.
- Claim: unit and interaction suites pass: partly checked; the four suites run here (512 tests) pass, and ESLint and the knowledge check pass.
- Claim: first-load deltas on the four reference pages: stated, not re-measured.
- File
.changeset/dropdown-menu-second-document.md: clear. - File
apps/storybook/stories/DropdownMenuSecondDocumentA11y.stories.tsx: clear. - File
docs/families/overlay-dismissal.md: approved for this head;verified_bymisses the new spec (non-blocking). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: the Effect at lines 1000-1002 (blocking); the close-path check is untested (non-blocking). - File
packages/core/src/DropdownMenu/__tests__/DropdownMenuSecondDocument.a11y.chromium.spec.ts: clear. - File
packages/core/src/Layer/gestureCounter.test.ts: clear. - File
packages/core/src/Layer/gestureCounter.ts: clear apart from its never-released listeners, covered by the Effect finding. - File
packages/core/src/Layer/useLayer.tsx: the settle-wait change is untested (non-blocking).
| if (typeof document.getAnimations !== 'function') { | ||
| // The anchor's own document and window: a trigger can sit in a frame or a | ||
| // pop-out window, whose animations and frames are its own. | ||
| const doc = anchor.ownerDocument; |
There was a problem hiding this comment.
Non-blocking: this settle wait runs only when the anchor had no layout box at show(), so it is not on the press-open path this pull request fixes. It changes every context layer whose trigger sits in a second document. A test (for example, a trigger in a Dialog that opens inside an iframe) or a separate pull request would make it reviewable on its own.
There was a problem hiding this comment.
The owners asked for the settle wait's document change in this pull request. No browser case covers it yet, and the description says so.
A DropdownMenu opens on a mouse press, and its trigger stays the popover's invoker through that press. The gesture counter listened only in the page's own document. A press in a frame or a pop-out window never counted, so that press's release light-dismissed the menu. The counter now also listens in the trigger's document, registered whenever the trigger node attaches through the layer's trigger ref. The menu checks the layer and the focused element in a way that works across windows. The layer's settle wait reads the anchor's own document.
1cda1eb to
1bb90e0
Compare
|
/approve-spec 1bb90e0 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once the pull request is marked ready for review.
A mouse click on a DropdownMenu trigger in a same-origin iframe, a Picture-in-Picture window or a window.open window now leaves the menu open, and the new browser spec fails its three mouse cases without the fix and passes all nine with it. No blocking findings remain: the second-document subscription now runs from the layer's trigger ref, and the reproduction line in the description is corrected.
Non-blocking:
- Add a mouse-pick case to the second-document spec: after Enter opens the menu in the iframe and a mouse picks a row, focus now returns to the trigger without a ring, and no test covers that close-path change.
- In the overlay-dismissal record, drop DropdownMenu root from the FR9 implementation-gap row and add it to the row that lists which members have real-browser second-document checks.
- The
gestureCounter.tsfile header is now 24 lines; dropping its list of exports brings it back toward the documented size.
Claims and files checked
Review mode: full; reason: history
Claims:
- A mouse press opens the menu in an iframe, a Picture-in-Picture window and a popup window, and it stays open: verified, the new spec passes 9 of 9 and an iframe capture shows the menu open after the release.
- Before the change the press opened the menu and fired
onClick, its release closed it, and Enter still opened it: verified on main with the new story and spec, where the 3 mouse cases fail (aria-expandedreadsfalse) and the Enter and Escape cases pass; the capture shows anonClickcount of 1. - The invoker hold and the pointer claim read the gesture counter, which listened only in the page's document: verified,
claimPressreturns early with no counted press, and main'slisten()installs only indocument. - The claim's
instanceof HTMLElementcheck fails for another window's element: verified,DropdownMenu.tsxnow uses the cross-windowisHTMLElement. listenForGestures(doc)counts presses and keystrokes indoc, and no entry point exports it: verified ingestureCounter.ts:180-187andLayer/index.ts; the API generator lists no change.- It is an internal export of an existing module, not a new module: verified, no source file is added.
- The close check reads the trigger's document: verified,
DropdownMenu.tsx:1060-1064. - The trigger ref registers each trigger's document, for any layer: verified,
useLayer.tsx:2032. - The settle wait reads the anchor's own document, timeline and frames: verified,
useLayer.tsx:917-966. - The press model, the keyboard and layers in the page are unchanged: verified, the page's document returns early, and the unit and interaction suites pass.
- Red first, then green, with no regression in the Popover second-document spec: verified, 3 mouse cases red on main, 9 of 9 green on the head, Popover 23 of 23 on both.
- No browser case covers the settle wait's document change: verified, no spec reaches a trigger without a box at show.
- The listed unit suites and the DropdownMenu, ContextMenu and Popover interaction specs pass: verified, unit suites pass and the interaction specs pass 57 of 57.
- Core typecheck, ESLint with no warnings, Prettier, the changeset check and the knowledge check pass: verified.
- Size +409/−22: verified; the bundle and reference-page deltas are reported as required and were not re-measured.
- Changeset: a patch fix in which a mouse press opens a menu whose trigger sits in an iframe or another window, and the menu stays open through the release: verified by the spec and the capture.
Files:
.changeset/dropdown-menu-second-document.md: clear.apps/storybook/stories/DropdownMenuSecondDocumentA11y.stories.tsx: clear.docs/families/overlay-dismissal.md: the new row is owner-approved at this head; two gap rows still name DropdownMenu (non-blocking).packages/core/src/DropdownMenu/DropdownMenu.tsx: clear; the close-path change has no test (non-blocking).packages/core/src/DropdownMenu/__tests__/DropdownMenuSecondDocument.a11y.chromium.spec.ts: clear.packages/core/src/Layer/gestureCounter.test.ts: clear.packages/core/src/Layer/gestureCounter.ts: clear; header length (non-blocking).packages/core/src/Layer/useLayer.tsx: clear; the settle wait has no test (non-blocking).
| return; | ||
| } | ||
| const active = document.activeElement; | ||
| const active = trigger.ownerDocument.activeElement; |
There was a problem hiding this comment.
Non-blocking: this check now runs in the trigger's document. In the iframe, after Enter opens the menu and a mouse picks a row, focus returns to the trigger without a ring; on main the page's activeElement is the iframe element, so this return never ran and the browser ringed the trigger. A mouse-pick case in DropdownMenuSecondDocument.a11y.chromium.spec.ts would keep that from regressing.
| | FR1 | `useFocusTrap.test.tsx` | active, nested, and deactivated traps with `onEscape` | A dismissible trap stays off the shared stack or nested traps respond together | | ||
| | FR1, FR2 | `ListReorder.test.tsx` | List's reorder-mode hint holding the focus, above an open layer | Escape reaches the layer below, or reorder mode outlives the Escape | | ||
| | FR8 | `useLayerDismissal.test.tsx`; `Popover.test.tsx` | members in the page and a same-origin iframe; a Popover alone and inside a Dialog, in an iframe | A press in one document dismisses a member of another, or a host closes over its nested layer | | ||
| | FR8 | `DropdownMenuSecondDocument.a11y.chromium.spec.ts` | a DropdownMenu in an iframe, in a Picture-in-Picture window and in a window that `window.open` opens: a mouse press opens it, and the menu stays open through that press's release | A press in the second document goes uncounted, so its release light-dismisses the menu it opened | |
There was a problem hiding this comment.
Non-blocking: two rows below still describe DropdownMenu as before this change. The FR9 gap row lists DropdownMenu root as deciding focus return from the page's document, and the real-browser row says only Dialog, Popover and HoverCard have second-document checks. Drop DropdownMenu root from the first and add DropdownMenu to the second.
| * release is handled), the press claims (claimPress, | ||
| * claimContextMenuPress), and the touch tap recognizer (useTapRecognizer, | ||
| * TOUCH_POINTER_TYPES) | ||
| * claimContextMenuPress), counting in another document (listenForGestures), |
There was a problem hiding this comment.
Non-blocking (INV29): the header is now 24 lines, past the documented size of about 12. The @output list names every export, which the code already shows. Keep the module's role and drop the list.
|
/approve-spec fa11cca |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once the pull request is marked ready for review.
A mouse click on a DropdownMenu trigger in a same-origin iframe, a Picture-in-Picture window or a window.open window now leaves the menu open: the new browser spec fails its three mouse cases without the fix and passes all nine with it, and the merge of main changes neither result. The new verification row in the overlay-dismissal record has an engineering owner's approval for this head.
Non-blocking:
- The gesture counter keeps its listeners in each extra document for that document's whole life; the runtime record lets a document-level listener persist only where a record names that lifetime, so either name it in the layer-runtime record or release the document when its last trigger detaches.
- Add a mouse-pick case to the second-document spec: after Enter opens the menu and a mouse picks a row, focus now returns to the trigger without a ring, and no test holds that.
- In the overlay-dismissal record, the FR9 implementation-gap row still lists DropdownMenu root, and the real-browser row still says only Dialog, Popover and HoverCard have second-document checks.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
Claims:
- A mouse press now opens a DropdownMenu whose trigger sits in a same-origin iframe or another window, and it stays open: verified, the new spec passes 9 of 9 on this head and the iframe capture shows the menu open after the click.
- Before the change the press opened the menu and fired
onClick, its release closed it, and Enter still opened it: verified onmainwith the new story and spec added, where the 3 mouse cases fail (aria-expandedreadsfalse) and the Enter cases pass; the capture shows a click count of 1 and a closed menu. - The menu is an auto popover, so the browser light-dismisses it on a release outside it: verified,
useLayer.tsx:2546. - On its opening press the menu keeps its trigger as the invoker and claims the pointer, and both read the gesture counter, which listened only in the page's document: verified,
DropdownMenu.tsx:1457-1468andgestureCounter.ts:301-305;maininstalled the counter's listeners only on the page's document. - The claim's
instanceof HTMLElementcheck fails for another window's element: verified,DropdownMenu.tsx:1511now uses the cross-windowisHTMLElement. - The overlay-dismissal record says a member works in the document it renders in, and this pull request adds DropdownMenu's press-open check to its verification table: verified,
overlay-dismissal.md:26and:317. listenForGestures(doc)counts presses and keystrokes indoc, and neitherLayer/index.tsnor the package exports it: verified,gestureCounter.ts:180-187; the API surface generator lists no change.- It is an internal export of an existing module, not a new module, and it extends the shared owner: verified, no source file is added and
useLayer.tsx:2058is its only caller. - The claim's and the close's checks work across windows, and the close reads the trigger's document: verified,
DropdownMenu.tsx:1060-1065and:1511. - The trigger ref registers the trigger's document whenever the trigger node attaches, for any layer: verified,
useLayer.tsx:2054-2058. - The settle wait reads the anchor's own document, timeline and frames: verified,
useLayer.tsx:927-970. - Moving a mounted trigger's node into another document without React is not supported: verified as stated, registration runs only in the trigger ref.
- The press model, the keyboard and layers in the page are unchanged: verified, the page's document returns early and its listeners were already installed when a layer mounts; the page menu-press spec passes 16 of 16.
- Red first: with only the three source files at
main's, the 3 mouse cases fail and the 3 Enter and 3 Escape cases pass: verified withmain's tree plus the new story and spec. - Each cause: without the trigger ref's registration the same 3 cases fail; with the
instanceofcheck restored, or the close check on the page's document, all 9 pass: verified, the first two by running each variant, the third by the Escape cases passing onmain, which has that close check. - Green: 9 of 9, and the Popover second-document spec shows no other layer regressed: verified, Popover's spec passes 23 of 23 on this head.
- No browser case covers the settle wait's document change: verified, no spec reaches an anchor without a box in a second document.
- The new
gestureCountercase needs this change, and the Layer, DropdownMenu, ContextMenu, Popover, Tooltip, MoreMenu, HoverCard, Selector and MultiSelector unit suites pass 2,199 tests in 83 files: verified, 2,199 of 2,199 in 83 files on this head. - DropdownMenu's, ContextMenu's and Popover's interaction specs pass 57 tests in Chromium: verified, 57 of 57 on this head.
- With
anchorReadiness,MenuHeaderFooter,DropdownMenuPendingOpenandfocusInClosedDialog, the neighbouring specs pass 49 tests: verified, 49 of 49 beside the new spec's 9. - Core typecheck, ESLint with no warnings, Prettier, the changeset check and the knowledge check pass: verified on this head.
listenInholds two document listeners that aremain's own keydown and click listeners, moved unchanged: verified,gestureCounter.ts:170-172.- Size +409/−22 (source +58/−22, tests +169, story +174, record +2, changeset +6): verified.
- Bundle growth of +27 to +103 B gzip per import and +57 to +81 B on the four reference pages: consistent, the import-boundaries check on this head shows every measured entry about +0.1 KB; the per-page figures were not re-measured.
- The merge of
main(#11905) leaves this pull request's own lines unchanged: verified, the merge is clean and the patch is unchanged hunk for hunk. - Changeset: a patch fix in which a mouse press opens a menu whose trigger sits in a same-origin iframe or another window, and the menu stays open through that press's release: verified by the spec and the capture.
Files:
.changeset/dropdown-menu-second-document.md: clear.apps/storybook/stories/DropdownMenuSecondDocumentA11y.stories.tsx: clear.docs/families/overlay-dismissal.md: the new row is owner-approved at this head; two gap rows still name DropdownMenu (non-blocking).packages/core/src/DropdownMenu/DropdownMenu.tsx: clear; the close-path change has no test (non-blocking).packages/core/src/DropdownMenu/__tests__/DropdownMenuSecondDocument.a11y.chromium.spec.ts: clear.packages/core/src/Layer/gestureCounter.test.ts: clear.packages/core/src/Layer/gestureCounter.ts: listener lifetime in extra documents unnamed by any record (non-blocking); header length (non-blocking).packages/core/src/Layer/useLayer.tsx: clear; the settle wait has no test (non-blocking).
| if (doc == null || doc === document || state.listenedDocuments.has(doc)) { | ||
| return; | ||
| } | ||
| state.listenedDocuments.add(doc); |
There was a problem hiding this comment.
Non-blocking (INV5): each extra document keeps these listeners for its whole life. architecture:react-component-runtime INV5 lets a document-level singleton persist across consumer gaps only "when current authority names that lifetime", and no record names this one; the modality tracker releases its second-document listeners when the last consumer leaves. Either name the lifetime in architecture:layer-runtime, or release the document when its last trigger detaches.
The release-specs plan resolves an a11y-* story id only through the checked-in visit map. The second-document DropdownMenu spec's story id had no entry, so the plan could not resolve its visit and its own test of this repository failed. The entry maps it to DropdownMenu's folder, as the Popover second-document story maps to Popover's.
|
/approve-spec e167878 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once the pull request is marked ready for review.
A mouse click on a DropdownMenu trigger in a same-origin iframe, a Picture-in-Picture window or a window.open window now leaves the menu open: the new browser spec fails its three mouse cases on main and passes here, and the new visit-map entry routes that spec to DropdownMenu. An engineering owner approved the new FR8 verification row for this exact head, and nothing blocks.
- Non-blocking: two rows in
docs/families/overlay-dismissal.mdstill describe DropdownMenu as before this change: the FR9 gap row (line 296) lists DropdownMenu root, and the real-browser row (line 321) names only Dialog, Popover and HoverCard. - Non-blocking: the focus-return check (
DropdownMenu.tsx:1060) and the settle wait's document change (useLayer.tsx:929) have no test of their own.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim, changeset: a mouse press opens a menu whose trigger is in a same-origin iframe or another window, and it stays open through the release: verified (iframe capture on main and here; browser spec red on main and green here for the iframe, Picture-in-Picture and
window.openwindows). - Claim: the auto popover light-dismisses on an outside release, and the press-open's invoker and press claim read a counter that listened only in the page: verified (
gestureCounter.tson main installs only ondocument;DropdownMenu.tsx:1500-1512). - Claim: the claim's
instanceof HTMLElementcheck is false for another window's element: verified (DropdownMenu.tsx:1511). - Claim: the counter also listens in the trigger's document, and the element checks work across windows: verified (
gestureCounter.ts:180,useLayer.tsx:2058,DropdownMenu.tsx:1060,:1511). - Claim:
listenForGesturesis exported from neitherLayer/index.tsnor the package, and extends an existing module: verified (Layer index and the exports map; no new source file). - Claim: the close reads the trigger's document: verified (
DropdownMenu.tsx:1060-1064). - Claim: the trigger ref registers the document whenever a trigger node attaches, for any layer: verified (
useLayer.tsx:2058, non-null branch). - Claim: the settle wait reads the anchor's own document, timeline and frames: verified (
useLayer.tsx:927-970). - Claim: moving a mounted trigger into another document without React is not supported: verified as stated (registration runs only when the ref attaches).
- Claim: the press model, the keyboard and page layers are unchanged: verified (the page's document returns early in
listenForGestures; Enter and Escape cases pass on main and here; unit suites pass). - Claim: before the change a click opens the menu, fires
onClick, and its release closes it witharia-expandedfalse: verified (iframe capture on main: one click,aria-expandedfalse, menu closed; spec red on main). - Claim: after the change the menu opens and stays open with
onClickonce: verified (iframe capture; spec). - Claim: Enter opens the menu in each document before and after: verified (spec on main and here).
- Claim: red first, 3 mouse cases fail on main and 3 Enter and 3 Escape cases pass: verified (spec on main with the story and spec).
- Claim: without the trigger-ref registration the 3 mouse cases fail, and with the old
instanceofcheck or the page-document close check all 9 pass: verified (runs for the first two; the close-check variant by code: Chromium returns focus on Escape itself, and no case reaches the difference). - Claim: the spec passes 9 of 9, the Popover second-document spec shows no other layer regressed, and the neighbouring specs pass: verified (9 of 9; Popover second-document specs pass; neighbouring specs pass).
- Claim: no browser case covers the settle wait: verified.
- Claim: the Layer, DropdownMenu, ContextMenu, Popover, Tooltip, MoreMenu, HoverCard, Selector and MultiSelector suites and the interaction specs pass: verified (2,199 unit tests and 57 interaction tests on identical sources; the Layer, DropdownMenu and Popover suites rerun here).
- Claim: typecheck, ESLint, Prettier, the changeset check and the knowledge check pass: verified (on identical sources; Prettier rerun on the new entry).
- Claim: the two document listeners moved unchanged: verified (
gestureCounter.ts:162-173against main). - Claim: size by kind (source +58/−22, tests +169, story +174, record +2, changeset +6): verified, plus 3 lines for the map entry.
- Claim: the reference pages grow by docs +81 B, form +81 B, menu +59 B and table +57 B: consistent with the per-entry measurement (+0.0 to +0.1 KB per entry), all under 0.3 KB.
- Claim: after the main merge the spec passes 9 of 9, units 2,199 and interaction 57: verified.
- Claim: without the visit-map entry the plan's test fails 2 of 22, and with it passes 22 of 22: verified (run here with main's map and with the head's).
- Claim: CI never ran the node job: draft runs skip it, and both ready runs found CI full: verified (this head's checks skipped; both earlier ready runs stopped because CI was full).
- Claim: the Node project failures on main are unrelated to this change, and no shipped file changes in the last commit: verified (no CLI code reads the changed files; the last commit changes only the visit map).
- File
.changeset/dropdown-menu-second-document.md: clear. - File
.github/release-spec-visits.json: clear. - File
apps/storybook/stories/DropdownMenuSecondDocumentA11y.stories.tsx: clear. - File
docs/families/overlay-dismissal.md: note, rows 296 and 321 not updated (non-blocking). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: note, focus-return check untested (non-blocking). - File
packages/core/src/DropdownMenu/__tests__/DropdownMenuSecondDocument.a11y.chromium.spec.ts: clear. - File
packages/core/src/Layer/gestureCounter.test.ts: clear. - File
packages/core/src/Layer/gestureCounter.ts: note, header size and listener lifetime (non-blocking). - File
packages/core/src/Layer/useLayer.tsx: note, settle wait untested (non-blocking).
|
/approve-spec d8e26ad |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once the pull request is marked ready for review.
A mouse click on a DropdownMenu trigger in a same-origin iframe, a Picture-in-Picture window or a window.open window now leaves the menu open: the new browser spec fails its three mouse cases on main and passes here. The latest push only merges main, and an engineering owner approved the new FR8 verification row for this exact head, so nothing blocks.
- Non-blocking: two rows in
docs/families/overlay-dismissal.mdstill describe DropdownMenu as before this change: the FR9 gap row (line 296) lists DropdownMenu root, and the real-browser row (line 321) names only Dialog, Popover and HoverCard. - Non-blocking: the focus-return check (
DropdownMenu.tsx:1060) and the settle wait's document change (useLayer.tsx:929) have no test of their own.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim, changeset: a mouse press opens a menu whose trigger is in a same-origin iframe or another window, and it stays open through the release: verified (browser spec red on
mainand green here for the iframe, Picture-in-Picture andwindow.openwindows; iframe capture on both). - Claim: the auto popover light-dismisses on an outside release, and the press-open's invoker and press claim read a counter that listened only in the page: verified (
main'sgestureCounter.tsinstalls only ondocument;DropdownMenu.tsx:1500-1512). - Claim: the claim's
instanceof HTMLElementcheck is false for another window's element: verified (DropdownMenu.tsx:1511now uses a node-type check,utils/nodeType.ts:46). - Claim: the counter also listens in the trigger's document, and the element checks work across windows: verified (
gestureCounter.ts:180,useLayer.tsx:2058,DropdownMenu.tsx:1060,:1511). - Claim:
listenForGesturesis exported from neitherLayer/index.tsnor the package, and extends an existing module: verified (Layer index and the exports map; no new source file; the built API surface lists no change). - Claim: the close reads the trigger's document: verified (
DropdownMenu.tsx:1060-1064). - Claim: the trigger ref registers the document whenever a trigger node attaches, for any layer: verified (
useLayer.tsx:2058, non-null branch). - Claim: the settle wait reads the anchor's own document, timeline and frames: verified (
useLayer.tsx:927-970). - Claim: moving a mounted trigger into another document without React is not supported: verified as stated (registration runs only when the ref attaches).
- Claim: the press model, the keyboard and page layers are unchanged: verified (the page's document returns early in
listenForGestures; Enter and Escape cases pass onmainand here; unit suites pass). - Claim: before the change a click opens the menu, fires
onClick, and its release closes it witharia-expandedfalse: verified (iframe capture onmain:onClick1,aria-expandedfalse, menu closed; spec red onmain). - Claim: after the change the menu opens and stays open with
onClickonce: verified (iframe capture; spec). - Claim: Enter opens the menu in each document before and after: verified (spec on
mainand here). - Claim: red first, the 3 mouse cases fail and the 3 Enter and 3 Escape cases pass: verified (spec run here on
mainwith the story and spec added). - Claim: without the trigger-ref registration the 3 mouse cases fail, and with the old
instanceofcheck or the page-document close check all 9 pass: verified in an earlier review on identical sources (the close-check variant by code). - Claim: the spec passes 9 of 9, and the Popover second-document spec shows no other layer regressed: verified (9 of 9 and 23 of 23 here).
- Claim: no browser case covers the settle wait: verified.
- Claim: the Layer, DropdownMenu, ContextMenu, Popover and other listed unit and interaction suites pass: verified (Layer, DropdownMenu, ContextMenu and Popover suites, 650 tests, here; the rest in an earlier review on identical sources).
- Claim: typecheck, ESLint, Prettier, the changeset check and the knowledge check pass: verified (ESLint, Prettier and Core's declaration build here; the rest in an earlier review on identical sources).
- Claim: the two document listeners moved unchanged: verified (
gestureCounter.ts:162-173againstmain). - Claim: size by kind (source +58/−22, tests +169, story +174, record +2, changeset +6): verified, plus 3 lines for the map entry.
- Claim: the reference pages grow by docs +81 B, form +81 B, menu +59 B and table +57 B: consistent with the per-entry measurement, all under 0.3 KB.
- Claim: after merging
mainthe spec still passes 9 of 9: verified at this head. - Claim: without the visit-map entry the plan's test fails, and with it the plan's tests pass: verified (35 of 35 here;
main's map fails 2 of 22 in an earlier review). - Claim: CI never ran the node job because draft runs skip it: verified (every CI job at this head concluded skipped).
- Claim: the Node project failures on
mainare unrelated, and the last commit changes no shipped file: verified (no CLI code reads the changed files). - Claim: the new verification row states only what the check covers and names the spec: verified (
docs/families/overlay-dismissal.md:317). - File
.changeset/dropdown-menu-second-document.md: clear. - File
.github/release-spec-visits.json: clear. - File
apps/storybook/stories/DropdownMenuSecondDocumentA11y.stories.tsx: clear. - File
docs/families/overlay-dismissal.md: note, rows 296 and 321 not updated (non-blocking). - File
packages/core/src/DropdownMenu/DropdownMenu.tsx: note, focus-return check untested (non-blocking). - File
packages/core/src/DropdownMenu/__tests__/DropdownMenuSecondDocument.a11y.chromium.spec.ts: clear. - File
packages/core/src/Layer/gestureCounter.test.ts: clear. - File
packages/core/src/Layer/gestureCounter.ts: note, header size and listener lifetime (non-blocking). - File
packages/core/src/Layer/useLayer.tsx: note, settle wait untested (non-blocking).












A mouse press now opens a DropdownMenu whose trigger sits in a same-origin iframe or another window, and the menu stays open.
User impact
An app can render part of its UI into a second document: a same-origin iframe, a Document Picture-in-Picture window, or a window that
window.openopens. There, a mouse press on a DropdownMenu trigger opened the menu, and that press's release closed it at once. Enter still opened it.Problem and solution fit
popover="auto", so the browser light-dismisses it on a release outside it. On its opening press, the menu keeps its trigger as the invoker and claims the pointer. Both steps read the gesture counter, which listened only in the page's own document. So neither ran for a press in another document.instanceof HTMLElement, false for another window's element, so the claim was skipped too.Expected behavior and authority
family:overlay-dismissalFR8: a member works in the document it renders in. This pull request adds DropdownMenu's press-open check to FR8's verification table.Smallest restoration
Layer/gestureCounter.ts:listenForGestures(doc)counts presses and keystrokes indoctoo. NeitherLayer/index.tsnor the package exports it.Layer/gestureCounter.ts, not a new module, soarchitecture:knowledge-contractsDEC-22 doesn't apply.architecture:react-component-runtimeINV16 extends the owner;family:overlay-dismissalFR8 requires it.DropdownMenu.tsx: the claim's and the close's checks work across windows; the close reads the trigger's document.useLayer.tsx: the trigger ref callslistenForGestures, so the trigger's document is registered whenever the trigger node attaches. Any layer trigger in another document now registers that document, not only a menu's. The settle wait reads the anchor's own document, timeline and frames.Evidence
onClick. Its release then closes the menu, soaria-expandedreadsfalse.onClickonce.Scope
Components: DropdownMenu, Layer
Testing
At 1bb90e0, on main 851cc90, on Storybook builds stamped with what they hold:
aria-expandedreadsfalseafter the release. The 3 Enter and 3 Escape cases pass.instanceof HTMLElementcheck restored, or the close check back on the page'sdocument, all 9 pass. No browser case separates those two checks, a moving-trigger case included. The Escape case is an unchanged path: Chromium hands focus back to the trigger itself.anchorReadinessandMenuHeaderFooter, those specs pass 44 tests. No browser case covers the settle wait's document change.check:changesetsandcheck:knowledgepass.review:prenotes two document listeners inlistenIn, main's own keydown and click listeners, moved unchanged. Moving them ontosubscribeInputchanges the page's own listeners too, a separate change.listenForGestures. Minified,gestureCounter.jsgrows +206 B anduseLayer.js+27 B there.DropdownMenuPendingOpenandfocusInClosedDialogadded, the neighbouring specs pass 49 tests. The interaction specs pass 57 tests, and 83 unit files pass 2,199, fix(DropdownMenu): a waiting open still takes focus and fires onClick #11905's cases among them. Core typecheck, ESLint, Prettier,check:changesetsandcheck:knowledgepass.a11y-*id to DropdownMenu's folder in.github/release-spec-visits.json. CI'snodejob never ran at a fix(DropdownMenu): a mouse press opens a menu in another document #11938 head: draft runs skip it, and both ready runs found CI full. At fa11cca, the plan's own test fails 2 of 22; at e167878, it passes 22 of 22. The full Node project on main c0b1279, with this change and the fix, fails 28 tests in 13packages/clifiles. Run alone, those 13 files fail the same 18 tests with and without this change, so none comes from it. No shipped file changes.check:changesetsandcheck:knowledgepass.Writing rubric results