Skip to content

fix(Layer): open on a trigger in a closed <dialog> that renders - #11864

Merged
cixzhang merged 3 commits into
meta:mainfrom
vjeux:fix/layer-closed-dialog-anchor
Nov 15, 2026
Merged

cixzhang merged 3 commits into
meta:mainfrom
vjeux:fix/layer-closed-dialog-anchor

Conversation

@vjeux

@vjeux vjeux commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A Popover, Tooltip or HoverCard never opens when its trigger sits in a native <dialog> that the page displays while it stays closed. A press or a hover on the trigger does nothing, and aria-expanded stays false.

Problem and solution fit

show() waits until its trigger is a valid anchor (#5398). It treats a trigger in any closed <dialog> as not ready, also when the trigger has a layout box.

That wait keeps a layer from opening beneath a Dialog about to call showModal(). Dialog displays its element in the render that opens it and calls showModal() in a later Effect.

A dialog that the page displays closed never toggles. No signal ends the wait, so the layer stays closed.

Expected behavior and authority

A requested open happens. This PR adds the owners' sentence on closed dialogs to architecture:layer-runtime, beside the browser-host rules.

The wait stays driven by signals, as INV12 requires. Nothing polls, and no timer ends it.

Smallest restoration

  • A trigger with a box in a closed <dialog> waits for the next commit. React runs the previous commit's Effects before it renders, so a Dialog that calls showModal() there is open by then. A dialog that is still closed stays out of the top layer. A trigger boxed at show() then opens at once, within the press, so a Popover's focus lands within it.
  • A dialog with display: none gives its trigger no box. The layer waits for it with no time limit, then takes the settle wait.
  • A second show() for the trigger that a wait observes keeps that wait. A controlled Popover calls show() on each render while it is closed, and a restart would ask for a render each time.

Evidence

  • Reproduction before the change: on main, a press leaves aria-expanded="false", and the tip stays hidden, in Chromium and in WebKit.
  • Result after the change: the same cases open, next to their triggers, in both engines. A click opens the Popover with its field focused within the click.
  • Representative unchanged path: a controlled Popover in a Dialog opens after showModal(), next to its trigger and above the dialog.
  • Regression test or other mutation-sensitive proof: under the reporter's rule (any box in a closed dialog is ready), the Dialog and Drawer unit guards fail.

Scope

Components: Layer (Popover, Tooltip, HoverCard and the other anchored layers)

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

Testing

At 1a8b48f, on a Storybook build made at this head and stamped with git rev-parse HEAD:

  • Red first, on main. The red runs used main c345076 with 554d786297's stories and tests, which differ from 7385883's only in comments. There, 4 of the 10 anchor-readiness cases fail in Chromium and in WebKit. They are the press, the hover, the press after the card expands, and the hidden dialog that the page shows later. The other 6 pass, the guard for fix(HoverCard,Tooltip): wait for the trigger to have a layout box before showing #5398's Dialog case included.
  • Red first, focus. At 7385883 with this head's stories and tests, the new focus case fails in Chromium and in WebKit, and the other 10 pass. That case checks, at the first frame after a click, that the Popover is open with its field focused.
  • The card case. The card that expands in flow before its press takes the same path as the basic press. Its trigger mounts in the closed dialog, and the press starts the same wait.
  • Green. All 11 pass in Chromium and in WebKit.
  • Units. The anchor-readiness block passes 18 of 18. With this head's tests, main fails 3, and 7385883 fails 2: the press and the controlled re-show. The case that asserted a wait for any closed dialog with a box now asserts the next-commit rule. Under the reporter's rule, the Dialog and Drawer guards fail. Without the second-show() rule, a controlled layer skips the settle wait while its dialog opens.
  • The full unit suite. Two earlier full runs each timed out semanticFence.shared.test.tsx, which the local results cache ran first; with that cache set aside, all 25,858 pass.
  • Interaction, Chromium. 16 Layer, Popover, Tooltip, Dialog and Drawer specs: 149 passed, 9 skipped.
  • Accessibility selection. CI's selection picks 32 specs, and they pass in Chromium: 175 tests. Its 6 cross-browser specs pass in WebKit: 25 tests.
  • Checks. ESLint with no warnings, Prettier, check:knowledge, check:changesets and review:pre (0 findings) pass. Typecheck passes in every package.

The runs above are at 1a8b48f; 7d13a88 changes only a comment in anchorReadiness.a11y.browser.spec.ts.

Writing rubric results

R1 narration: none. The added sentence in architecture:layer-runtime states what the runtime does, in the present tense.
R2 research: none in the record.
R3 evidence: no evidence cell changed.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: none.
R7 project status: none.

Public and internal API delta

None public. Internal: show() waits one commit for a trigger with a box in a closed <dialog>. A second show() for the same trigger keeps its wait. architecture:layer-runtime gains one sentence.

  • Size: +668/−34 lines (c345076..1a8b48f): source +78/−4, tests +404/−29, stories +171/−1, record and changeset +15. The repository's component size report measures 116 imports. Of those, 109 change by −2 to +155 B gzip, and no CSS changes. core/Popover grows by 101 B (100,753 → 100,854), and core/Tooltip by 129 B (32,771 → 32,900). The INV10 reference pages grow by 98 B (docs), 118 B (form), 143 B (menu) and 113 B (table).

show() waited for the trigger's <dialog> to be open or shown as a
popover. A closed dialog that the page displays in flow never toggles,
so the layer never opened.

A trigger with a box in a closed dialog now waits for the next commit.
React runs the previous commit's Effects first, so a Dialog that calls
showModal() in them is open by then. A dialog that is still closed then
stays out of the top layer, and the layer opens. A dialog with
display: none still holds the wait.

A second show() for the trigger that a wait observes keeps that wait.
The decision asks for a render, and a controlled Popover calls show()
on each render while it is closed.
@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 1: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, 2:01 PM UTC

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

Copy link
Copy Markdown
Contributor

/approve-spec 7385883

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 7d13a88

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
LayerProvider 4.4 kB (0) · 20 B CSS (0) — ✓ · ✓ · ✗
ChatComposerTokenElement 82.2 kB (+155 B) · 12.1 kB CSS (0) — — · — · —
SegmentedControl 102.1 kB (+155 B) · 6.9 kB CSS (0) — — · — · —
115 more components
Component Size LoC Visual · A11y · RTL
ChatComposerInput 82.2 kB (+153 B) · 12.1 kB CSS (0) — — · — · —
lab/CommentPin 60.4 kB (+152 B) · 1.2 kB CSS (0) — — · — · —
AlertDialog 128.6 kB (+144 B) · 15.4 kB CSS (0) — — · — · —
TabMenu 78.8 kB (+144 B) · 11.9 kB CSS (0) — — · — · —
lab/TourStep 93.2 kB (+144 B) · 691 B CSS (0) — — · — · —
lab/ListInput 93.5 kB (+143 B) · 922 B CSS (0) — — · — · —
TopNavMenu 81.5 kB (+142 B) · 12.0 kB CSS (0) — — · — · —
StatusDot 33.8 kB (+140 B) · 5.4 kB CSS (0) — — · — · —
MoreMenu 107.5 kB (+139 B) · 18.8 kB CSS (0) — — · — · —
lab/TransferListSelector 121.0 kB (+139 B) · 1.4 kB CSS (0) — — · — · —
InfoTip 50.4 kB (+138 B) · 5.4 kB CSS (0) — — · — · —
ChatComposer 84.6 kB (+136 B) · 12.9 kB CSS (0) — — · — · —
Avatar 45.9 kB (+134 B) · 5.7 kB CSS (0) — — · — · —
ComplexSelector 77.6 kB (+131 B) · 12.6 kB CSS (0) — — · — · —
DropdownMenu 107.2 kB (+131 B) · 18.8 kB CSS (0) — — · — · —
InputGroup 61.0 kB (+131 B) · 7.9 kB CSS (0) — — · — · —
ToggleButton 92.0 kB (+131 B) · 10.9 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 113.5 kB (+130 B) · 773 B CSS (0) — — · — · —
CheckboxInput 69.0 kB (+129 B) · 10.1 kB CSS (0) — — · — · —
Tooltip 32.1 kB (+129 B) · 4.5 kB CSS (0) — — · — · —
lab/CommentThread 362.5 kB (+128 B) · 2.4 kB CSS (0) — — · — · —
AppShell 97.6 kB (+127 B) · 14.3 kB CSS (0) — — · — · —
AvatarGroup 48.7 kB (+127 B) · 5.8 kB CSS (0) — — · — · —
BaseTypeahead 78.3 kB (+126 B) · 11.7 kB CSS (0) — — · — · —
Field 59.4 kB (+126 B) · 7.3 kB CSS (0) — — · — · —
lab/EmojiPicker 92.4 kB (+125 B) · 751 B CSS (0) — — · — · —
FieldLabel 55.3 kB (+124 B) · 5.8 kB CSS (0) — — · — · —
Slider 114.5 kB (+124 B) · 8.9 kB CSS (0) — — · — · —
lab/CommentComposer 173.4 kB (+124 B) · 1.9 kB CSS (0) — — · — · —
FileInput 74.1 kB (+123 B) · 11.7 kB CSS (0) — — · — · —
Typeahead 87.8 kB (+123 B) · 13.5 kB CSS (0) — — · — · —
charts/Chart 237.9 kB (+122 B) · 516 B CSS (0) — — · — · —
BreadcrumbItem 96.7 kB (+122 B) · 13.3 kB CSS (0) — — · — · —
Carousel 74.7 kB (+122 B) · 11.7 kB CSS (0) — — · — · —
DateTimeInput 223.5 kB (+122 B) · 19.7 kB CSS (0) — — · — · —
charts/ChartTooltip 215.0 kB (+121 B) · 451 B CSS (0) — — · — · —
CheckboxList 73.1 kB (+121 B) · 7.8 kB CSS (0) — — · — · —
TopNavMegaMenu 76.1 kB (+121 B) · 12.6 kB CSS (0) — — · — · —
AvatarGroupOverflow 51.9 kB (+120 B) · 5.7 kB CSS (0) — — · — · —
CheckboxListItem 79.9 kB (+120 B) · 12.0 kB CSS (0) — — · — · —
lab/ChatReactionBar 114.6 kB (+119 B) · 1.1 kB CSS (0) — — · — · —
Thumbnail 69.3 kB (+118 B) · 12.3 kB CSS (0) — — · — · —
ListItem 79.0 kB (+117 B) · 12.0 kB CSS (0) — — · — · —
SideNavItem 76.9 kB (+117 B) · 11.9 kB CSS (0) — — · — · —
DateInput 200.0 kB (+116 B) · 17.9 kB CSS (0) — — · — · —
MobileNav 76.2 kB (+116 B) · 11.4 kB CSS (0) — — · — · —
Markdown 202.4 kB (+115 B) · 21.9 kB CSS (0) — — · — · —
DropdownMenuSubMenu 78.2 kB (+114 B) · 10.4 kB CSS (0) — — · — · —
Pagination 123.7 kB (+114 B) · 19.0 kB CSS (0) — — · — · —
RadioList 60.8 kB (+114 B) · 7.3 kB CSS (0) — — · — · —
MultiSelector 101.4 kB (+113 B) · 17.7 kB CSS (0) — — · — · —
TopNavHeading 82.1 kB (+113 B) · 12.0 kB CSS (0) — — · — · —
HoverCard 30.2 kB (+112 B) · 4.5 kB CSS (0) — — · — · —
Selector 112.8 kB (+112 B) · 18.6 kB CSS (0) — — · — · —
TextArea 66.8 kB (+112 B) · 9.4 kB CSS (0) — — · — · —
ChatLayout 88.3 kB (+110 B) · 11.3 kB CSS (0) — — · — · —
SideNavHeading 82.5 kB (+110 B) · 12.1 kB CSS (0) — — · — · —
Toolbar 47.1 kB (+109 B) · 8.1 kB CSS (0) — — · — · —
DrawerHeader 68.0 kB (+108 B) · 13.7 kB CSS (0) — — · — · —
SideNav 121.2 kB (+108 B) · 12.2 kB CSS (0) — — · — · —
Toast 103.6 kB (+108 B) · 11.1 kB CSS (0) — — · — · —
lab/SelectableCardGroup 68.7 kB (+108 B) · 162 B CSS (0) — — · — · —
ContextMenu 101.8 kB (+107 B) · 18.7 kB CSS (0) — — · — · —
Switch 108.9 kB (+107 B) · 10.0 kB CSS (0) — — · — · —
Table 119.9 kB (+107 B) · 19.6 kB CSS (0) — — · — · —
ChatSendButton 65.4 kB (+106 B) · 10.8 kB CSS (0) — — · — · —
TableHeaderCell 102.7 kB (+106 B) · 18.9 kB CSS (0) — — · — · —
TopNav 78.0 kB (+106 B) · 11.7 kB CSS (0) — — · — · —
richtext/RichTextEditor 305.5 kB (+106 B) · 2.6 kB CSS (0) — — · — · —
TableCell 103.0 kB (+105 B) · 19.1 kB CSS (0) — — · — · —
richtext/RichTextView 282.1 kB (+105 B) · 2.3 kB CSS (0) — — · — · —
NumberInput 77.5 kB (+102 B) · 12.2 kB CSS (0) — — · — · —
DateRangeInput 99.3 kB (+101 B) · 13.3 kB CSS (0) — — · — · —
Link 56.3 kB (+101 B) · 7.1 kB CSS (0) — — · — · —
Popover 98.5 kB (+101 B) · 15.1 kB CSS (0) — — · — · —
lab/DiffViewer 93.1 kB (+101 B) · 2.1 kB CSS (0) — — · — · —
Banner 67.0 kB (+100 B) · 11.3 kB CSS (0) — — · — · —
PowerSearch 306.7 kB (+100 B) · 25.5 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 299.5 kB (+100 B) · 454 B CSS (0) — — · — · —
Calendar 76.1 kB (+99 B) · 11.4 kB CSS (0) — — · — · —
lab/DialogHeroHeader 88.5 kB (+99 B) · 372 B CSS (0) — — · — · —
ChatLayoutScrollButton 65.6 kB (+98 B) · 11.0 kB CSS (0) — — · — · —
ChatDictationButton 65.5 kB (+97 B) · 10.8 kB CSS (0) — — · — · —
lab/Schedule 114.6 kB (+97 B) · 3.9 kB CSS (0) — — · — · —
lab/Comments 369.6 kB (+95 B) · 2.5 kB CSS (0) — — · — · —
Lightbox 145.9 kB (+94 B) · 11.9 kB CSS (0) — — · — · —
TableSelectionToolbar 75.2 kB (+94 B) · 14.0 kB CSS (0) — — · — · —
MobileNavToggle 65.3 kB (+91 B) · 10.8 kB CSS (0) — — · — · —
TimeInput 174.7 kB (+91 B) · 16.9 kB CSS (0) — — · — · —
RadioListItem 76.1 kB (+90 B) · 10.7 kB CSS (0) — — · — · —
SideNavCollapseButton 65.8 kB (+90 B) · 10.8 kB CSS (0) — — · — · —
Button 65.0 kB (+89 B) · 10.8 kB CSS (0) — — · — · —
DialogHeader 67.8 kB (+88 B) · 12.3 kB CSS (0) — — · — · —
Tokenizer 104.3 kB (+88 B) · 20.3 kB CSS (0) — — · — · —
TabList 47.2 kB (+87 B) · 6.5 kB CSS (0) — — · — · —
IconButton 65.0 kB (+83 B) · 10.8 kB CSS (0) — — · — · —
TextInput 72.7 kB (+83 B) · 12.0 kB CSS (0) — — · — · —
lab/TransferList 112.1 kB (+73 B) · 1.2 kB CSS (0) — — · — · —
lab/TabBarMoreList 101.9 kB (+71 B) · 1.8 kB CSS (0) — — · — · —
CodeBlock 80.1 kB (+70 B) · 12.1 kB CSS (0) — — · — · —
Stepper 66.7 kB (+67 B) · 10.9 kB CSS (0) — — · — · —
lab/LineClamp 13.5 kB (+1 B) · 168 B CSS (0) — — · — · —
charts/ChartLegend 40.2 kB (0) · 224 B CSS (0) — — · — · —
ChatMessageList 27.3 kB (0) · 7.1 kB CSS (0) — — · — · —
ChatToolCalls 31.6 kB (0) · 8.4 kB CSS (0) — — · — · —
CommandPalette 77.8 kB (0) · 12.7 kB CSS (0) — — · — · —
Heading 11.5 kB (0) · 5.5 kB CSS (0) — — · — · —
ProgressBar 11.9 kB (0) · 6.4 kB CSS (0) — — · — · —
CommandPaletteInput 32.9 kB (−1 B) · 7.6 kB CSS (0) — — · — · —
Spinner 24.0 kB (−1 B) · 6.3 kB CSS (0) — — · — · —
Text 11.0 kB (−1 B) · 5.5 kB CSS (0) — — · — · —
Timestamp 26.9 kB (−1 B) · 11.0 kB CSS (0) — — · — · —
Timer 13.0 kB (−2 B) · 6.1 kB CSS (0) — — · — · —
layer — — — · ✓ · —
Layer — — ✓ · ✓ · —

Package size: @astryxdesign/core 7.60 MB packed (+1.9 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

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
@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.

Requesting changes: anchored layers now open when their trigger sits in a native <dialog> that the page displays while closed, and a layer inside Dialog still waits for showModal(), but one case still falls short.

  • A Popover opened by a click in a displayed closed dialog opens a frame after the click, so its initial focus lands after it (packages/core/src/Layer/useLayer.tsx, the next-commit decision and the settle wait that follows it), while Popover's user-activation focus rule requires focus within the tap or click because iOS raises its keyboard only then: open in the press's own task when the decision finds the dialog still closed, or record this exception in that Popover rule and in the new layer-runtime sentence with an owner's approval.

Also, the comment above the anchor-wait refs in useLayer.tsx still says the next show() cancels the wait; a show() for the same trigger now keeps it.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim (changeset): anchored layers open again when their trigger sits in a displayed closed dialog. Verified: useLayer.tsx:1866-1875; the new press case fails on the base and passes on the head; Chromium press and hover open on the head, not on the base.
  • Claim (changeset): such a dialog never enters the top layer, so its trigger is a valid anchor. Verified: nothing calls showModal() or showPopover() on it.
  • Claim (changeset): the layer waited for the dialog to open, and it never opened. Verified: the base readiness check requires open or :popover-open.
  • Claim (changeset): a layer still waits for a Dialog that displays before showModal(). Verified: unit case for a dialog opened in its commit's Effects; Dialog.tsx:654-678.
  • Claim (changeset): Dialog, Drawer, Lightbox and MobileNav open their dialog in the Effects of the commit that displays it. Verified: Dialog.tsx:654, useDrawerDialogPresence.ts:139, Lightbox.tsx:885 (a layout Effect), MobileNav.tsx:604.
  • Claim (changeset): a trigger with a box in a closed dialog waits one more commit, and a dialog still closed then lets the layer open. Verified: useLayer.tsx:1727-1738, :1853-1875.
  • Claim (changeset): a closed dialog with display: none keeps the wait with no time limit. Verified: useLayer.tsx:883-889 requires a box; unit case for a hidden dialog.
  • Claim (changeset): a second show() for the same trigger keeps the wait. Verified: useLayer.tsx:1776-1782; unit case for a controlled layer.
  • Claim (description): on the base a press leaves aria-expanded="false" and the tip hidden; after the change both open next to their triggers. Verified in Chromium; WebKit not re-run.
  • Claim (description): a controlled Popover in a Dialog still opens after showModal(), next to its trigger and above the dialog. Verified in Chromium: identical frames on base and head, hit-test on the popover.
  • Claim (description): treating any box in a closed dialog as ready fails the Dialog and Drawer guards. Verified by a mutation run.
  • Claim (description): without the second-show() rule the controlled case hits React's update-depth limit. Verified by a mutation run.
  • Claim (description): the anchor-readiness block passes 17 of 17, and 3 of its 5 new or rewritten cases fail on the base. Verified.
  • Claim (description): the wait stays signal-driven, with no polling and no timer. Verified: no timer added.
  • Claim (description): a requested open happens. Partly: the layer opens, but a Popover's focus lands after the click (the finding above).
  • Claim (description): no new public API. Verified: built Core and theme surfaces are identical.
  • Claim (description): full-suite, interaction, accessibility, lint and typecheck results. Not re-run; the Layer, Popover, Tooltip, HoverCard, Dialog, Drawer and BottomSheet unit folders pass.
  • Claim (description): bundle size and reference-page deltas. Reported, not re-measured.
  • File packages/core/src/Layer/useLayer.tsx: the blocking finding; one stale comment.
  • File packages/core/src/Layer/useLayer.test.tsx: clear.
  • File packages/core/src/Layer/__tests__/anchorReadiness.a11y.browser.spec.ts: clear (not run here).
  • File apps/storybook/stories/LayerDismissal.stories.tsx: clear.
  • File docs/architecture/layer-runtime.md: the new sentence conflicts with Popover's user-activation focus rule for this case (same finding).
  • File .changeset/layer-closed-dialog-anchor.md: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Layer/useLayer.tsx Resolved
Comment thread packages/core/src/Layer/useLayer.tsx Resolved
Comment thread docs/architecture/layer-runtime.md Resolved
The decision for a trigger in a closed <dialog> ran the settle wait,
so the layer opened a frame after the press. Popover's initial focus
then landed after the tap, and iOS raises its keyboard only for a
focus made while the tap is handled.

The decision's commit runs before the press's task ends, because React
flushes a discrete event's updates in that task. When it finds the
dialog still closed and the trigger had its box when show() ran, the
layer now opens at once, as it does for a trigger with a box anywhere
else. A trigger that got its box later, as the page displayed its
dialog, still takes the settle wait, because the dialog can still be
animating in. A dialog that opens in that commit's Effects still ends
the wait through its open or toggle signal, and the settle wait
follows.

The comment above the anchor-wait refs now names what cancels a wait:
hide(), a show() for another trigger, or unmount. A unit case pins why
a second show() keeps the wait: as a controlled layer calls show()
again while its dialog opens, the settle wait for the dialog's entry
animation stays.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 7d13a88

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The pull request is still a draft, and marking it ready for review starts its CI run.

Anchored layers now open when their trigger sits in a native <dialog> that the page displays while closed, and a click or tap on a Popover trigger there now moves focus into the popover within that click, which was the remaining gap. A layer inside Dialog still waits until the dialog is modal.

  • Non-blocking: the edited comment above the anchor-wait refs in useLayer.tsx still describes the wait as only for a trigger with no layout box, and its second sentence runs long; the inline comment suggests a rewrite.
Claims and files checked

Review mode: incremental; reason: none

  • Release note: anchored layers open again when their trigger sits in a displayed closed dialog. Verified: useLayer.tsx:1864-1888; a press and a hover open on the head and not on the base in Chromium; three new unit cases fail on the base.
  • Release note: such a dialog never enters the top layer, so its trigger is a valid anchor. Verified: nothing calls showModal() or showPopover() on it, and readiness requires open or :popover-open (useLayer.tsx:865-875).
  • Release note: the layer waited for a dialog that never opened. Verified: the base's readiness check and its signals (open, toggle, resize, intersection).
  • Release note: a layer still waits for a Dialog that displays its element before showModal(). Verified: the unit case for a dialog opened in its commit's Effects; the controlled Popover in Dialog renders identically on base and head and hit-tests above the dialog.
  • Release note: Dialog, Drawer, Lightbox and MobileNav open their dialog in the Effects of the commit that displays it. Verified: Dialog.tsx:652-678, useDrawerDialogPresence.ts:139 with :76-81, Lightbox.tsx:885-894, MobileNav.tsx:604-620.
  • Release note: a trigger with a box waits one more commit and opens at once if the dialog is still closed. Verified: useLayer.tsx:1829, :1864-1879.
  • Release note: for a press, that commit runs inside the press, so the layer and its initial focus land within it. Verified in Chromium: focus is in the popover's field when the click reaches the window, for a mouse click and for a touch tap; the unit and browser cases for it fail at the previous revision and pass here.
  • Release note: a dialog with display: none keeps the wait with no time limit. Verified: useLayer.tsx:883-889 requires a box; unit case.
  • Release note: a second show() for the same trigger keeps the wait. Verified: useLayer.tsx:1776-1782; removing it fails the settle-wait unit case.
  • Description: on main a press leaves aria-expanded="false" and the tip hidden, and after the change both open next to their triggers. Verified in Chromium; WebKit not re-run.
  • Description: the wait stays signal-driven, with no polling or timer. Verified: no timer is added; the new end of the wait is a requested commit.
  • Description: a controlled Popover calls show() on each render while it is closed. Verified: Popover.tsx:1037-1050.
  • Description: under the "any box is ready" rule the Dialog and Drawer guards fail. Verified: treating any box as ready fails both guards.
  • Description: without the second-show() rule a controlled layer skips the settle wait while its dialog opens. Verified: removing the rule fails that unit case.
  • Description: red-first browser runs (the closed-dialog cases fail on main, only the focus case fails at the previous revision, all 11 pass here). Verified in Chromium; WebKit not re-run.
  • Description: the anchor-readiness unit block passes 18 of 18, main fails 3 and the previous revision fails 2. Verified.
  • Description: 16 Layer, Popover, Tooltip, Dialog and Drawer interaction specs pass in Chromium (149 passed, 9 skipped). Verified.
  • Description: the full unit suite passes. Partly verified: the unit folders of every layer consumer pass (4,172 tests); the whole suite was not re-run.
  • Description: CI's accessibility selection passes in Chromium and WebKit. Partly verified: the anchor-readiness spec passes in Chromium.
  • Description: ESLint, Prettier, the knowledge and changeset checks and typecheck pass. Verified for ESLint, Prettier, check:knowledge, check:changesets and the Core typecheck; the changed story file has no type error; the pre-review checklist was not re-run.
  • Description: the last commit changes only one comment line in the browser spec. Verified.
  • Description: no public API change. Verified: the API generator lists no changed rows for Core and the seven themes.
  • Description: size +668/−34 and its split by kind. Verified.
  • Description: bundle and reference-page deltas. Reported in the description, as required; not re-measured.
  • File packages/core/src/Layer/useLayer.tsx: non-blocking comment suggestion.
  • File packages/core/src/Layer/useLayer.test.tsx: clear.
  • File packages/core/src/Layer/__tests__/anchorReadiness.a11y.browser.spec.ts: clear.
  • File apps/storybook/stories/LayerDismissal.stories.tsx: clear.
  • File docs/architecture/layer-runtime.md: clear.
  • File .changeset/layer-closed-dialog-anchor.md: clear.

Automated review (maintainer link)


// A wait for the trigger to get a layout box, started by a show() that
// found none. Cancelled by the next show()/hide() or by
// found none. Cancelled by hide(), by a show() for another trigger, or by

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.

Non-blocking: this comment still says the wait is "for the trigger to get a layout box, started by a show() that found none", but it also covers a trigger with a box inside a closed <dialog>, and the second sentence runs 26 words. A shorter version that keeps the reason:

// A wait for the trigger to become a valid anchor, started by a show() that
// found it not ready. hide(), a show() for another trigger, or unmount
// cancels it. So a stale wait never fires openNow() after the fact.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, thanks. To keep this approved head as is, your rewrite lands in a small follow-up after this merges.

This branch was successfully deployed

1 active deployment
Preview — 7d13a88b 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