Skip to content

fix(layer): a press on another trigger of an open layer opens it there - #11337

Merged
cixzhang merged 5 commits into
mainfrom
l0/layer-browser-close
Nov 13, 2026
Merged

cixzhang merged 5 commits into
mainfrom
l0/layer-browser-close

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: people using a layer that several triggers share, such as Schedule's event popover (one popover for every event block, chip and "+N more").
  • Before: the layer runtime treated any show in the same gesture as a closed layer reopening itself. A press on another trigger while the popover was open was closed by the browser's light dismiss, and the show from the pressed trigger was lost, so Schedule carried its own press-capture code in two views to work around the runtime.
  • After: a press on another trigger opens the layer there, with a mouse or a finger. A press on the open trigger still closes it. The workaround code is gone from the week and day views; the month view keeps one narrow case (below).

Problem and solution fit

  • Why does it happen? Two things in useLayer:
    • The browser starts a light-dismiss hide at the press's release (beforetoggle) and reports it a task later (toggle). The press's click lands in between. useLayer still counted the layer as open, so a show from that click did nothing, and then the hide's toggle closed it.
    • On engines whose toggle lands before the click, wasJustDismissed() absorbed every show in that gesture, from any trigger.
  • Why does it harm the task? Switching between Schedule events looked broken without per-view press code, and any other multi-trigger layer would hit the same thing.
  • Why does it matter? The owner asked for this class of bug to be fixed once, in the layer runtime, not in each component.

Mechanism:

  • useLayer notes, at beforetoggle, that the browser has started closing the layer and for which trigger. The close is still reported at the hide's toggle, as today.
  • A show from another trigger while that hide is in flight moves the layer to the new trigger: it opens there at once, the old trigger's close is not reported (a controlled parent sees open A, then open B), and the hide's toggle changes nothing.
  • A press on the open trigger, or on a separate control that toggles a controlled layer, works as today: the click still sees the layer open and hides it.
  • For engines whose toggle lands before the click, the dismissal remembers the trigger the layer was open for, and only a same-gesture show from that trigger is absorbed.

Month view's narrow case: a busy day's "+N more" can hand an event to the same popover, which keeps "+N more" as its trigger. A press on "+N more" while that event is open shows the day's list again (the Schedule record's intended return). That press comes from the trigger the layer is open for, so the runtime correctly absorbs it; the month hook closes the popover ahead of the browser for that one case only (the pressed trigger is expanded but owns switched content).

Expected behavior and authority

  • architecture:layer-runtime INV7, narrowed: "The press that closes a layer cannot reopen it from the trigger it was open for; a press on another trigger of the same layer may show it, anchored to that trigger: a show in the same gesture from another trigger moves the layer to that trigger."
  • The lifecycle paragraph keeps "Browser-initiated closes are observed through the queued toggle event" and adds: "A show from another trigger while such a close is in flight moves the layer to that trigger; that close is not reported."
  • INV6 (single-fired close reconciliation) holds; a test covers a browser close followed by hide() in the same task.

Smallest restoration

  • Layer/useLayer.tsx: notes a browser-started hide and its trigger at beforetoggle; a show from another trigger during that hide moves the layer; the hide's toggle then reports nothing; the dismissal remembers its trigger and absorbs only a same-gesture show from it.
  • lab/Schedule/TimeGridView.tsx: removes the press-capture block and the remembered press.
  • lab/Schedule/useScheduleViewPopover.ts: removes the remembered press and the general press-capture; keeps only the "+N more" return described above.
  • Tests: useLayer.test.tsx, Schedule.test.tsx, and the two Schedule Chromium specs.
  • Record: docs/architecture/layer-runtime.md (lifecycle paragraph, INV7, verification row).
  • A [fix] Changeset.

Evidence

  • Real Chrome probe (Chrome 157, the current canary build of Schedule's week view, a held mouse click and a finger tap; switch to another event / press the open event / keyboard Enter and Escape):
Build Switch Open event pressed Keyboard
main (with the workaround) opens closes works
workaround removed lost reopens works
removed, trigger-scoped absorb only lost reopens works
removed, this pull request (the layer moves to the new trigger) opens closes works
  • Unit tests (useLayer.test.tsx):
    • a press on another trigger that light-dismissed the layer opens it there, and the parent sees open A then open B, with no close between. Red first: it fails on main;
    • a controlled layer toggled by a separate control during a light dismiss stays in step with its state. Red first: it fails on the previous head;
    • a press on the open trigger ends closed;
    • a browser close followed by hide() in the same task fires onHide once.
  • Schedule.test.tsx: the week and month switch tests simulate the browser's light dismiss instead of the removed press capture; the "+N more" handoff test now also presses "+N more" again and gets the day's list back.
  • Chromium specs (run on CI's browser legs): ScheduleEventPopover adds a press on the open event (mouse and finger) and a finger switch between events; ScheduleMonthEventPopover adds the "+N more" return.
  • The Layer, Popover, DropdownMenu, ContextMenu, Tooltip, Selector, BottomSheet, Dialog and Schedule suites pass: 2,605 tests. Core and Lab tsc, eslint, check:knowledge and check:changesets pass.
  • Device check before merge: a phone and a desktop mouse on Schedule's multi-trigger popover, one single-trigger Popover, and one Tooltip.

Scope

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

Writing rubric results

  • Present tense, system description only: yes (INV7 and the lifecycle paragraph describe current behavior; no history or pull-request references).
  • One topic per sentence, active voice: yes.
  • Claims are verifiable: each new sentence maps to a test in the verification row.
  • No duplicated owner: the change extends architecture:layer-runtime's existing INV7 and lifecycle text; no new record.

A close the browser starts itself is now recorded at its beforetoggle, so
a show from the press's click is a new open that the popover-operations
ledger replays after the hide. The dismissal remembers the trigger the
layer was open for, and only a same-gesture show from that trigger is
absorbed. Schedule's press-capture workarounds are removed; the month
view keeps one narrow case, a press on "+N more" while its handed event
is open, which shows the day's list again.
@vercel

vercel Bot commented Nov 12, 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 13, 2026 3:24am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 12, 2026
@astracat-bot

astracat-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 13, 2026, 3:53 AM UTC

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

Copy link
Copy Markdown
Contributor Author

/approve-spec ea93fde

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 12, 2026
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · a420f92

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) — ✓ · ✓ · ✗
Field 59.3 kB (+158 B) · 7.3 kB CSS (0) — — · — · —
RadioList 60.6 kB (+158 B) · 7.3 kB CSS (0) — — · — · —
115 more components
Component Size LoC Visual · A11y · RTL
InputGroup 60.9 kB (+154 B) · 7.9 kB CSS (0) — — · — · —
SegmentedControl 101.9 kB (+147 B) · 6.9 kB CSS (0) — — · — · —
lab/Comments 367.1 kB (+146 B) · 2.5 kB CSS (0) — — · — · —
TextArea 66.7 kB (+145 B) · 9.4 kB CSS (0) — — · — · —
lab/CommentThread 360.1 kB (+145 B) · 2.4 kB CSS (0) — — · — · —
lab/DiffViewer 92.3 kB (+140 B) · 2.1 kB CSS (0) — — · — · —
lab/EmojiPicker 91.8 kB (+137 B) · 751 B CSS (0) — — · — · —
lab/Schedule · Storybook 111.4 kB (+137 B) · 3.9 kB CSS (0) 4,753 (−44) — · ✓ · ✓
SideNav 119.7 kB (+135 B) · 11.7 kB CSS (0) — — · — · —
lab/CommentComposer 158.2 kB (+134 B) · 1.9 kB CSS (0) — — · — · —
CheckboxList 72.9 kB (+133 B) · 7.8 kB CSS (0) — — · — · —
MobileNav 74.9 kB (+133 B) · 11.0 kB CSS (0) — — · — · —
ChatComposer 83.9 kB (+132 B) · 12.4 kB CSS (0) — — · — · —
CheckboxListItem 75.6 kB (+132 B) · 11.7 kB CSS (0) — — · — · —
FileInput 73.5 kB (+132 B) · 11.3 kB CSS (0) — — · — · —
AlertDialog 110.6 kB (+131 B) · 15.0 kB CSS (0) — — · — · —
Lightbox 145.3 kB (+131 B) · 11.5 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 112.1 kB (+129 B) · 773 B CSS (0) — — · — · —
ChatLayout 87.7 kB (+128 B) · 10.9 kB CSS (0) — — · — · —
DateRangeInput 98.6 kB (+128 B) · 12.9 kB CSS (0) — — · — · —
NumberInput 76.9 kB (+128 B) · 11.8 kB CSS (0) — — · — · —
Pagination 117.7 kB (+128 B) · 18.2 kB CSS (0) — — · — · —
Tokenizer 103.1 kB (+128 B) · 19.5 kB CSS (0) — — · — · —
TopNav 76.6 kB (+128 B) · 11.3 kB CSS (0) — — · — · —
lab/TransferListSelector 115.9 kB (+128 B) · 1.4 kB CSS (0) — — · — · —
DropdownMenu 103.6 kB (+127 B) · 17.9 kB CSS (0) — — · — · —
MobileNavToggle 64.8 kB (+127 B) · 10.3 kB CSS (0) — — · — · —
lab/ChatReactionBar 113.3 kB (+127 B) · 1.1 kB CSS (0) — — · — · —
SideNavItem 76.3 kB (+126 B) · 11.5 kB CSS (0) — — · — · —
ChatLayoutScrollButton 65.0 kB (+125 B) · 10.5 kB CSS (0) — — · — · —
Thumbnail 68.8 kB (+125 B) · 11.9 kB CSS (0) — — · — · —
Toolbar 47.0 kB (+125 B) · 8.1 kB CSS (0) — — · — · —
BreadcrumbItem 91.0 kB (+124 B) · 12.5 kB CSS (0) — — · — · —
ChatComposerTokenElement 81.6 kB (+123 B) · 11.7 kB CSS (0) — — · — · —
MultiSelector 100.7 kB (+123 B) · 17.2 kB CSS (0) — — · — · —
Stepper 66.1 kB (+123 B) · 10.5 kB CSS (0) — — · — · —
TableCell 115.6 kB (+123 B) · 18.3 kB CSS (0) — — · — · —
Toast 102.7 kB (+123 B) · 10.6 kB CSS (0) — — · — · —
ChatComposerInput 81.6 kB (+122 B) · 11.7 kB CSS (0) — — · — · —
ListItem 74.7 kB (+122 B) · 11.7 kB CSS (0) — — · — · —
Tooltip 31.9 kB (+121 B) · 4.5 kB CSS (0) — — · — · —
Link 56.1 kB (+120 B) · 7.1 kB CSS (0) — — · — · —
SideNavCollapseButton 65.3 kB (+120 B) · 10.4 kB CSS (0) — — · — · —
TableHeaderCell 115.2 kB (+120 B) · 18.0 kB CSS (0) — — · — · —
Banner 66.4 kB (+119 B) · 10.9 kB CSS (0) — — · — · —
InfoTip 50.2 kB (+119 B) · 5.4 kB CSS (0) — — · — · —
Selector 106.6 kB (+119 B) · 17.9 kB CSS (0) — — · — · —
StatusDot 33.6 kB (+119 B) · 5.4 kB CSS (0) — — · — · —
Markdown 195.2 kB (+118 B) · 21.1 kB CSS (0) — — · — · —
lab/SelectableCardGroup 68.6 kB (+118 B) · 162 B CSS (0) — — · — · —
richtext/RichTextEditor 303.7 kB (+118 B) · 2.6 kB CSS (0) — — · — · —
TopNavHeading 81.5 kB (+117 B) · 11.6 kB CSS (0) — — · — · —
richtext/RichTextView 281.4 kB (+117 B) · 2.3 kB CSS (0) — — · — · —
MoreMenu 103.8 kB (+116 B) · 17.9 kB CSS (0) — — · — · —
Popover 96.8 kB (+116 B) · 14.6 kB CSS (0) — — · — · —
Slider 114.2 kB (+116 B) · 8.9 kB CSS (0) — — · — · —
TableSelectionToolbar 74.7 kB (+115 B) · 13.6 kB CSS (0) — — · — · —
lab/DialogHeroHeader 87.9 kB (+115 B) · 372 B CSS (0) — — · — · —
Calendar 75.5 kB (+114 B) · 11.0 kB CSS (0) — — · — · —
ChatSendButton 64.8 kB (+114 B) · 10.3 kB CSS (0) — — · — · —
CodeBlock 79.7 kB (+114 B) · 11.6 kB CSS (0) — — · — · —
lab/TourStep 92.4 kB (+114 B) · 691 B CSS (0) — — · — · —
richtext/RichTextEditorToolbar 286.3 kB (+114 B) · 454 B CSS (0) — — · — · —
charts/Chart 211.5 kB (+113 B) · 516 B CSS (0) — — · — · —
DrawerHeader 67.5 kB (+113 B) · 13.3 kB CSS (0) — — · — · —
IconButton 64.5 kB (+113 B) · 10.3 kB CSS (0) — — · — · —
lab/TransferList 107.1 kB (+113 B) · 1.2 kB CSS (0) — — · — · —
Carousel 74.1 kB (+112 B) · 11.3 kB CSS (0) — — · — · —
DialogHeader 67.3 kB (+112 B) · 11.9 kB CSS (0) — — · — · —
TextInput 72.1 kB (+112 B) · 11.5 kB CSS (0) — — · — · —
lab/ListInput 92.9 kB (+112 B) · 922 B CSS (0) — — · — · —
ComplexSelector 76.9 kB (+111 B) · 12.2 kB CSS (0) — — · — · —
DropdownMenuSubMenu 74.3 kB (+111 B) · 10.1 kB CSS (0) — — · — · —
Table 132.2 kB (+111 B) · 18.7 kB CSS (0) — — · — · —
DateInput 196.1 kB (+110 B) · 17.4 kB CSS (0) — — · — · —
RadioListItem 71.9 kB (+110 B) · 10.4 kB CSS (0) — — · — · —
ChatDictationButton 65.0 kB (+109 B) · 10.4 kB CSS (0) — — · — · —
BaseTypeahead 77.7 kB (+108 B) · 11.3 kB CSS (0) — — · — · —
SideNavHeading 81.8 kB (+108 B) · 11.7 kB CSS (0) — — · — · —
AppShell 96.2 kB (+107 B) · 13.8 kB CSS (0) — — · — · —
AvatarGroup 48.6 kB (+107 B) · 5.8 kB CSS (0) — — · — · —
CheckboxInput 68.7 kB (+107 B) · 10.1 kB CSS (0) — — · — · —
ContextMenu 114.3 kB (+107 B) · 17.8 kB CSS (0) — — · — · —
AvatarGroupOverflow 51.8 kB (+106 B) · 5.7 kB CSS (0) — — · — · —
Button 64.4 kB (+106 B) · 10.3 kB CSS (0) — — · — · —
TabList 47.1 kB (+106 B) · 6.5 kB CSS (0) — — · — · —
Typeahead 86.9 kB (+106 B) · 12.8 kB CSS (0) — — · — · —
charts/ChartTooltip 188.6 kB (+105 B) · 451 B CSS (0) — — · — · —
ToggleButton 91.4 kB (+105 B) · 10.4 kB CSS (0) — — · — · —
TopNavMegaMenu 75.4 kB (+105 B) · 12.2 kB CSS (0) — — · — · —
lab/CommentPin 60.2 kB (+105 B) · 1.2 kB CSS (0) — — · — · —
DateTimeInput 218.6 kB (+103 B) · 19.1 kB CSS (0) — — · — · —
Avatar 45.8 kB (+101 B) · 5.7 kB CSS (0) — — · — · —
PowerSearch 303.7 kB (+101 B) · 24.7 kB CSS (0) — — · — · —
TabMenu 78.1 kB (+97 B) · 11.5 kB CSS (0) — — · — · —
lab/TabBarMoreList 97.4 kB (+97 B) · 1.8 kB CSS (0) — — · — · —
FieldLabel 55.2 kB (+95 B) · 5.8 kB CSS (0) — — · — · —
TimeInput 169.3 kB (+93 B) · 16.4 kB CSS (0) — — · — · —
HoverCard 30.1 kB (+91 B) · 4.5 kB CSS (0) — — · — · —
TopNavMenu 80.8 kB (+81 B) · 11.6 kB CSS (0) — — · — · —
Switch 108.7 kB (+74 B) · 10.0 kB CSS (0) — — · — · —
lab/LineClamp 16.4 kB (+2 B) · 168 B CSS (0) — — · — · —
ChatToolCalls 34.8 kB (+1 B) · 8.4 kB CSS (0) — — · — · —
CommandPaletteInput 34.3 kB (+1 B) · 7.6 kB CSS (0) — — · — · —
ProgressBar 12.0 kB (+1 B) · 6.4 kB CSS (0) — — · — · —
Timestamp 35.8 kB (+1 B) · 10.6 kB CSS (0) — — · — · —
charts/ChartLegend 54.8 kB (0) · 224 B CSS (0) — — · — · —
ChatMessageList 30.6 kB (0) · 7.1 kB CSS (0) — — · — · —
CommandPalette 75.9 kB (0) · 12.7 kB CSS (0) — — · — · —
Heading 14.8 kB (0) · 5.5 kB CSS (0) — — · — · —
Spinner 27.1 kB (0) · 6.3 kB CSS (0) — — · — · —
Timer 16.3 kB (0) · 6.1 kB CSS (0) — — · — · —
Text 14.2 kB (−1 B) · 5.5 kB CSS (0) — — · — · —
layer — — — · ✓ · —
Layer — — ✓ · ✓ · —

Package size: @astryxdesign/core 7.48 MB packed (+704 B); no new dependencies.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@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 are needed, and approval also waits on a spec decision: this pull request deliberately narrows architecture:layer-runtime INV7 (today, the same press that closes a layer cannot immediately reopen it) and records a close the browser starts at beforetoggle instead of the queued toggle. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner.

Blocking

  • A controlled Popover whose isOpen another control toggles now ends hidden with its state true when that control is pressed while the popover is open, because onHide runs before the press's click and the click's show() is then absorbed (useLayer.tsx lines 2046-2047, Popover.tsx lines 1047-1048, useLayer.tsx lines 1561-1566), so keep reporting the close to callers at toggle unless a show from another trigger arrives first, and add a regression test.
  • Two description claims are wrong: the current layer-runtime record does state that browser-initiated closes are observed through the queued toggle event, and openNow shows the same-gesture show at once (the ledger replays only a refused show), so correct both sentences and the matching comment at useLayer.tsx lines 2036-2038.

The new unit tests and Chromium specs have not run on this head yet because CI skips drafts; smaller suggestions are inline.

Claims and files checked
  • Claim: a press on another trigger of a shared layer opens it there. Verified in code and the new unit test.
  • Claim: a press on the open trigger still closes the layer. Verified in code and the new unit test.
  • Claim: for a close the browser starts, onHide and isOpen arrive one task earlier. Verified; this also covers popover="auto" eviction, which the changeset does not mention.
  • Claim: Schedule's week and day views drop their workaround, and the month view keeps one narrow case. Verified in the diff.
  • Claim: before this change the close was recorded only at toggle, and every same-gesture show was absorbed. Verified in the base code.
  • Claim: the operations ledger replays the same-gesture show after the hide. False for the switch, which shows at once.
  • Claim: an engine without beforetoggle still reports the close at toggle. Verified.
  • Claim: no documented contract promised the later timing. False; the record's lifecycle paragraph states it.
  • Claim: single-fired close holds, with a new test. Verified in code.
  • Claim: the new unit test fails before the change. Verified by reading both versions of the code.
  • Claim: the listed suites, typecheck, lint and knowledge checks pass. Not verified; CI did not run on this draft.
  • File .changeset/layer-browser-close-other-trigger.md: clear.
  • File docs/architecture/layer-runtime.md: waits on the spec decision.
  • File packages/core/src/Layer/useLayer.tsx: blocking regression, plus inline suggestions.
  • File packages/core/src/Layer/useLayer.test.tsx: clear.
  • File packages/lab/src/Schedule/Schedule.test.tsx: clear.
  • File packages/lab/src/Schedule/TimeGridView.tsx: clear, with one inline suggestion.
  • File packages/lab/src/Schedule/useScheduleViewPopover.ts: clear.
  • File packages/lab/src/Schedule/__tests__/ScheduleEventPopover.a11y.chromium.spec.ts: clear.
  • File packages/lab/src/Schedule/__tests__/ScheduleMonthEventPopover.a11y.chromium.spec.ts: 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 packages/core/src/Layer/useLayer.tsx Resolved
Comment thread packages/core/src/Layer/useLayer.tsx Resolved
// A press on another block while the popover is open opens it there; a
// press on the open block ends closed: the layer absorbs a show from the
// trigger its light dismiss closed it for.
if (isCurrent && popover.isOpen) {

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: a press on the open block now gets past this check, because onHide already cleared openBlock at the light dismiss. It then sets openBlock (line 278) before the absorbed show(). The closed popover keeps that event's renderPopover content mounted until the next open. useScheduleViewPopover.ts:122 does the same with openKey. aria-expanded stays correct, because it also checks popover.isOpen.

… trigger moves the layer

Reporting the close at beforetoggle let a separate control that toggles a
controlled layer reopen it, and the show was absorbed: the layer ended
hidden with its state open. The close is reported at toggle again, as
before. beforetoggle only notes the hide and its trigger; a show from
another trigger during that hide moves the layer there, and the old
trigger's close is not reported. The changeset drops the timing note.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 76fd6ad

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
…toggles

A fixture for the device check: a controlled Popover with a separate
button that opens and closes it.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e766f9a

@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 because the pull request is a draft, and it runs once the pull request is ready for review.

The narrowed architecture:layer-runtime INV7 and the new lifecycle sentence carry an engineering owner's approval for this head. The controlled-Popover regression from the earlier revision is fixed: the browser's close is reported at toggle again, with a regression test.

Non-blocking:

  • Where the light dismiss is reported before the click, a press on the open Schedule event can leave its key set on the closed popover, so that event's renderPopover content stays mounted while hidden (TimeGridView.tsx:279, useScheduleViewPopover.ts:122).
  • Two Schedule comments say the absorb is why a press on the open trigger closes, but in the usual order the click itself calls hide(); data-schedule-event-block is now rendered with no reader.
Claims and files checked
  • Claim: A press on another trigger of an open layer opens it there, with a mouse or a finger (verified: useLayer.tsx:1579-1590; new unit test (fails on the base by trace); Schedule Chromium finger case).
  • Claim: A press on the open trigger still closes it (verified: TimeGridView.tsx:275-278, useScheduleViewPopover.ts:118-121; unit test).
  • Claim: The browser's close is still reported at its toggle (verified: useLayer.tsx:2101-2111).
  • Claim: When the layer moves, the old trigger's close is not reported and a controlled parent sees open A then open B (verified: useLayer.tsx:2097-2099; the unit test asserts the log).
  • Claim: A separate control that toggles a controlled layer works as before (verified: unit test for a controlled layer; Popover.tsx:1037-1050 sync traced).
  • Claim: Where the toggle lands before the click, only a same-gesture show from the dismissed trigger is absorbed (verified: useLayer.tsx:1570-1575, :1990).
  • Claim: On the base the click's show did nothing during the hide, and every same-gesture show was absorbed (verified: base openNow).
  • Claim: The week and day press capture is removed; the month view keeps only the "+N more" return, which the Schedule record intends (verified: TimeGridView.tsx diff, useScheduleViewPopover.ts:97-110, Schedule DEC-7).
  • Claim: The record text quoted in the description matches the head record, and INV6 holds with a test (verified: layer-runtime.md:311-317, :537-541; single-fired close test).
  • Claim: The new unit tests fail on the base or the previous revision (verified by trace; not run).
  • Claim: The named suites (2,605 tests), typecheck, lint and the knowledge and changeset checks pass (not verified here: CI has not run on this head).
  • Claim: Real Chrome probe results and the planned device check (author's stated evidence; consistent with the code for this revision).
  • Claim: Changeset: a layer with several triggers opens at another trigger, with a mouse or a finger; a press on the open trigger still closes it (verified, as above).
  • File: .changeset/layer-browser-close-other-trigger.md: clear.
  • File: apps/storybook/stories/Popover.stories.tsx: clear.
  • File: docs/architecture/layer-runtime.md: clear (owner-approved).
  • File: packages/core/src/Layer/useLayer.tsx: clear; one comment note.
  • File: packages/core/src/Layer/useLayer.test.tsx: clear.
  • File: packages/lab/src/Schedule/TimeGridView.tsx: non-blocking: stale open key, comment, dead attribute.
  • File: packages/lab/src/Schedule/useScheduleViewPopover.ts: non-blocking: stale open key, comment.
  • File: packages/lab/src/Schedule/Schedule.test.tsx: clear.
  • File: packages/lab/src/Schedule/__tests__/ScheduleEventPopover.a11y.chromium.spec.ts: clear.
  • File: packages/lab/src/Schedule/__tests__/ScheduleMonthEventPopover.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

Comment on lines +272 to +274
// A press on another block while the popover is open opens it there; a
// press on the open block ends closed: the layer absorbs a show from the
// trigger its light dismiss closed it for.

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 (INV29): in the usual order the click still sees the popover open and calls hide() below; the absorb applies only when the light dismiss is reported before the click. Suggested:

// A press on the open block closes the popover. If the light dismiss is
// reported before the click, the layer absorbs this show.

Comment on lines +112 to +116
// A press on another trigger while the popover is open: the browser's
// light dismiss closes it as the press ends, and this show from the other
// trigger opens it there. A press on the open trigger ends closed: its
// light dismiss closes the popover, and the layer absorbs the show from
// that same trigger.

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 (INV29): the same reason as in TimeGridView.tsx. In the usual order the click sees the popover open and toggle calls hide(); the absorb applies only when the light dismiss is reported first. Suggested:

// A press on another trigger opens the popover there. A press on the open
// trigger closes it. If the light dismiss is reported before the click, the
// layer absorbs this show.

Comment on lines +1390 to +1393
// A hide the browser has started on its own (light dismiss, popover="auto"
// stack eviction, an Escape its close watcher answers), from `beforetoggle`
// until its `toggle`, with the trigger the layer was open for. `moved` is
// set when a show from another trigger reopens the layer during that hide.

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 (INV29): this is one 33-word fragment. Suggested:

// A hide the browser started on its own, from `beforetoggle` until its
// `toggle`. It keeps the trigger the layer was open for. `moved` marks a
// show from another trigger during that hide.

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e766f9a

@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 06:05
# Conflicts:
#	docs/architecture/layer-runtime.md
@cixzhang
cixzhang marked this pull request as draft November 12, 2026 06:41
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2c796b1

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

Approved. Moving a shared layer to the pressed trigger in useLayer matches the narrowed layer-runtime INV7 and lifecycle text that an engineering owner approved for this head, and the new unit tests and Schedule Chromium specs pass in CI.

Nothing blocks. Two optional follow-ups: add a two-trigger test where the hide's toggle lands before the click, since no current test reaches the trigger check in openNow in that order; and the earlier notes on Schedule's stale open key, comment wording and the unused data-schedule-event-block attribute still apply.

Claims and files checked
  • Before: a press on another trigger of an open layer lost its show, and Schedule carried its own press code: verified against the base openNow and the removed Schedule handlers.
  • After: a press on another trigger opens the layer there with a mouse or a finger, and a press on the open trigger still closes it: verified by the new unit tests and the Schedule Chromium specs, which pass in CI.
  • The week and day workaround is gone, and the month view keeps only the "+N more" return: verified in TimeGridView.tsx and useScheduleViewPopover.ts.
  • Cause: the click's show lands between the browser's beforetoggle and toggle while the layer still counts as open, and toggle-first engines absorbed every show in the gesture: verified against the base code.
  • Mechanism: the hide and its trigger are noted at beforetoggle, the close is still reported at toggle, a show from another trigger moves the layer without reporting the old close, and a separate control still toggles a controlled layer: verified in code and by the unit tests.
  • Toggle-first engines absorb only a same-gesture show from the dismissed trigger: verified in code; no test drives this order with two triggers.
  • Record text for INV7, the lifecycle paragraph and the verification row matches the description, and INV6 keeps its test: verified.
  • Red-first claims for the switch test and the controlled test: verified by reading the base and the earlier head.
  • Suites, typecheck, lint and knowledge checks pass: verified by CI at this head.
  • Real-Chrome probe and the planned device check: stated in the description and judged from that text.
  • No new public API and no internal context in public text: verified.
  • Changeset: verified against the same evidence as the After claim.
  • Files: changeset, Popover story, layer-runtime record, useLayer.tsx, useLayer.test.tsx, Schedule.test.tsx, TimeGridView.tsx, both Schedule Chromium specs and useScheduleViewPopover.ts: all ten visited; findings only in useLayer.tsx, TimeGridView.tsx and useScheduleViewPopover.ts, all non-blocking.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2c796b1

@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 11:10
# Conflicts:
#	docs/architecture/layer-runtime.md
#	packages/core/src/Layer/useLayer.tsx
@cixzhang
cixzhang marked this pull request as draft November 13, 2026 03:14
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a420f92

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 13, 2026 03:30
@cixzhang

Copy link
Copy Markdown
Contributor Author

Decision: D-20261113-088

Carries the owner's "11337 good" device pass to a420f92: a real-phone farm side-by-side (desktop and iPhone, 2 of 2) against 2c796b1, where her pass was last verified, found no difference after this main merge resolved useLayer.tsx. Nothing is waived.

@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: two Node test legs are still running on this head.

Moving a shared layer to the pressed trigger in useLayer matches the narrowed layer-runtime INV7 and lifecycle text that an engineering owner approved at this head, and the merge from main leaves that path intact. Two non-blocking follow-ups remain:

  • A two-trigger test where the hide's toggle lands before the click would guard the trigger-scoped absorb (useLayer.tsx:1567-1570), which no test or browser run reaches today.
  • In that same order, a press on the open Schedule event leaves its key set on the closed popover (TimeGridView.tsx:279, useScheduleViewPopover.ts:122).
Claims and files checked
  • Changeset: a shared layer opens at another trigger when the press on that trigger closes it, by mouse or finger — verified (useLayer.test.tsx:1905 fails on main and passes here; two-trigger runs in Chromium and Firefox; finger switch in Schedule's Chromium spec).
  • Changeset: a press on the open trigger still closes it — verified (useLayer.test.tsx:1931; Chromium runs).
  • Before this change, a press on another trigger lost the show and the layer ended closed — verified (main in Chromium and Firefox).
  • Schedule carried press-capture code in its views — verified (handlers removed from TimeGridView.tsx and useScheduleViewPopover.ts).
  • The click's show found the layer still open and did nothing, then the hide's toggle closed it — verified (main's openNow; red-first test).
  • Where the toggle lands before the click, main absorbed every same-gesture show from any trigger — verified (main's openNow).
  • The hide and its trigger are noted at beforetoggle, and the close is still reported at toggle — verified (useLayer.tsx:2080-2088, :2120-2131).
  • A show from another trigger during that hide moves the layer, and the parent sees open A then open B — verified (useLayer.test.tsx:1905; browser log).
  • A press on the open trigger, or a separate control toggling a controlled layer, works as before — verified (useLayer.test.tsx:1931, :1948, passing on main and here).
  • Where the toggle lands first, only a show from the dismissed trigger is absorbed — verified by code (useLayer.tsx:1567-1570); no test drives that order.
  • The week and day views drop the workaround; the month view keeps only the "+N more" return — verified (diff; Schedule.test.tsx:1542; month Chromium spec).
  • The quoted INV7 and lifecycle text match the record — verified (layer-runtime.md:310-314, :538-542).
  • INV6 holds, with a test for a browser close then hide() in one task — verified (useLayer.test.tsx:1992).
  • The switch test fails on main, and the controlled-toggle test failed on the earlier head — verified (both reruns).
  • The Schedule tests simulate the light dismiss, and the "+N more" test returns the day's list — verified (Schedule.test.tsx:971, :1272, :1542).
  • The Chromium specs add the open-event press, finger switch and "+N more" return — verified (they pass in CI at this head).
  • The named suites, typecheck, lint, knowledge and changeset checks pass — verified (the suites, Core and Lab typecheck, lint on the changed files, and both checks pass here).
  • No new public API — verified (built surfaces of Core and the themes are unchanged).
  • Public text carries no internal context — verified.
  • Files: .changeset/layer-browser-close-other-trigger.md clear; apps/storybook/stories/Popover.stories.tsx clear; docs/architecture/layer-runtime.md clear; packages/core/src/Layer/useLayer.test.tsx clear; packages/core/src/Layer/useLayer.tsx note (toggle-first test gap, comment wording); packages/lab/src/Schedule/Schedule.test.tsx clear; packages/lab/src/Schedule/TimeGridView.tsx note (stale key, comment wording, unused attribute); ScheduleEventPopover.a11y.chromium.spec.ts clear; ScheduleMonthEventPopover.a11y.chromium.spec.ts clear; packages/lab/src/Schedule/useScheduleViewPopover.ts note (stale key, comment wording).

Automated review (maintainer link)

Comment on lines +1567 to +1570
if (
wasJustDismissed() &&
dismissedTriggerRef.current === triggerRef.current
) {

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 trigger comparison matters only where the hide's toggle lands before the click, and no test drives that order with two triggers (the toggle-first tests under light dismiss vs. the trigger click use one). Chromium and Firefox both deliver the click first, so removing the comparison would still pass every test and browser run. Suggested test: dispatch the toggle to closed, click B and expect the layer open at B; repeat from A and expect it closed.

This branch was successfully deployed

1 active deployment
Preview — a420f928 Deployed Nov 13, 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.

1 participant