Skip to content

refactor(layer): a closing BottomSheet takes the shared input hold - #11447

Merged
cixzhang merged 4 commits into
mainfrom
l0/hold-kept-inside
Nov 13, 2026
Merged

cixzhang merged 4 commits into
mainfrom
l0/hold-kept-inside

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: people who close a BottomSheet while a control inside it has focus, and people using the page around a closing sheet.
  • What changes for them: nothing. A closing sheet behaves as before: the page stays live, a sheet that keeps focus takes no click and no key but Tab, and the sheet is inert and hidden once focus leaves it.
  • Why it matters: the sheet's exit now uses the layer runtime's one input hold instead of rules of its own, so any later fix to that hold reaches the sheet too.

Problem and solution fit

  • architecture:layer-runtime INV16 says a component that holds input uses the runtime's hold rather than building its own. It listed two gaps:
    • BottomSheet built its own exit hold.
    • The shared hold had no mode that keeps focused content live, which component:BottomSheet FR9 needs.
  • holdInput gains focus: 'kept-inside', the sheet's rules moved into the shared module:
    • No viewport shield and no window press hold, and the layer lets every pointer through. A tap on the page during the exit still acts, and a tap on the closing sheet reaches what is beneath it, as today.
    • While focus stays inside, the content stays exposed, and the document's capture phase stops every click and every key but Tab that targets the layer. The interaction-modality tracker, which listens there from the first consumer's mount, still hears the key, so focus returns with the keyboard ring as on main. React's root and capture handlers inside the sheet do not hear it.
    • When focus leaves (moved, or dropped because the focused element was removed, disabled, hidden or made inert), or when it was not inside, the layer itself becomes inert and aria-hidden until the hold ends. That matches FR9's "the sheet becomes inert and aria-hidden".
  • focus: 'blur', the default, is today's dismissal. Dialog, Drawer, MobileNav entrances, the presentation hold, Popover surface motion and DropdownMenu do not change. AlertDialog FR7 and switcher steps stay on 'blur'.

What changed

  • Layer/inputHold.ts: the focus option and holdKeptInside.
  • BottomSheet/BottomSheet.tsx: a standalone sheet's exit takes holdInput(dialog, {scope: 'layer', focus: 'kept-inside'}) from when its close settles to the end of its exit. Its own exit-focus state, focus watcher, click and key capture handlers, pass-through style, and exit-time inert and aria-hidden go away. A replaced sheet and a covered (blocked) sheet keep their own inert.
  • docs/architecture/layer-runtime.md: INV16 names focus: 'kept-inside' as FR9's mechanism. Both INV16 gap lines are removed, INV16 leaves the "not yet met" list, and the verification row names the new cases and BottomSheetCloseFocus.test.tsx.
  • A [chore] Changeset.

Evidence

  • Red first: four new inputHold.test.tsx cases fail on main and pass here:
    • the page stays live with no shield;
    • focused content stays exposed, with no click and no key but Tab;
    • the layer itself goes inert and hidden once focus leaves;
    • the layer itself goes inert and hidden at once when focus was not inside.
      A fifth case pins the unchanged 'blur' dismissal.
  • Review rounds: a document listener added before the hold hears a key the hold keeps from the layer, and no capture handler inside a closing sheet runs for a key or a click (BottomSheetCloseFocus.test.tsx; fails on the earlier head).
  • Why one capture case covers every row kind: the hold stops a key or click that targets the closing sheet on the document's capture phase, before React's root listener. So no React handler inside the sheet runs for it, whatever the row: an onClick row, a link (href) row, or a capture-phase handler around them. The unit case uses a capture-phase handler around a button. On a real sheet, the farm checks that a second activation of an action-sheet row selects nothing (core-dropdownmenu--action-sheet-presentation); no served story has an items-built sheet menu with a link row.
  • Unchanged behavior: the BottomSheet suites, including BottomSheetCloseFocus.test.tsx's FR9 cases, pass unchanged. So do the Dialog, Drawer, Popover, DropdownMenu, MobileNav, inputHold and holdEntranceInput suites (1,547 tests in 59 files).
  • Core tsc, check:component-import-boundaries, check:knowledge, check:changesets and the snap-paging bundle test pass.
  • No feel change is intended: the page and the closing sheet take pointers exactly as before. If a farm check is wanted, the cases are a tap on the page during a sheet's exit, and Enter on a focused control in a closing sheet.

Writing rubric results

  • Present tense, system description only: yes.
  • One topic per sentence, active voice: yes.
  • Claims are verifiable: each INV16 sentence maps to a named test.
  • No duplicated owner: INV16 owns the hold, and BottomSheet FR9 keeps its rule.

holdInput gains focus: kept-inside for a dismissal that keeps the page
live: no shield and no window press hold, and the layer lets every
pointer through. While focus stays inside, the content stays exposed and
no click and no key but Tab reaches it; when focus leaves, or was not
inside, the layer itself is inert and aria-hidden until the hold ends.
A standalone BottomSheet exit takes it in place of its own exit rules,
with no behavior change. Both INV16 gap lines close.
@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 5:16am 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, 8:08 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 5d37652

@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 · a27b533

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BottomSheet 🔴 72.7 kB (+2.7 kB) · 7.7 kB CSS (0) — ✗ · ✓ · —
BottomSheetSwitcher 18.7 kB (0) · 3.4 kB CSS (0) — ✗ · ✓ · —
LayerProvider 4.4 kB (0) · 20 B CSS (0) — ✓ · ✓ · ✗
54 more components
Component Size LoC Visual · A11y · RTL
Selector 🔴 109.4 kB (+2.8 kB) · 17.9 kB CSS (0) — — · — · —
Pagination 🔴 120.5 kB (+2.8 kB) · 18.2 kB CSS (0) — — · — · —
ContextMenu 🔴 117.1 kB (+2.7 kB) · 17.8 kB CSS (0) — — · — · —
TableHeaderCell 🔴 117.9 kB (+2.7 kB) · 18.0 kB CSS (0) — — · — · —
TableCell 🔴 118.3 kB (+2.7 kB) · 18.3 kB CSS (0) — — · — · —
Markdown 🔴 198.1 kB (+2.7 kB) · 21.1 kB CSS (0) — — · — · —
Table 🔴 135.1 kB (+2.7 kB) · 18.7 kB CSS (0) — — · — · —
lab/Schedule 🔴 114.0 kB (+2.6 kB) · 3.9 kB CSS (0) — — · — · —
DateInput 🔴 198.8 kB (+2.6 kB) · 17.4 kB CSS (0) — — · — · —
DateTimeInput 🔴 221.2 kB (+2.6 kB) · 19.1 kB CSS (0) — — · — · —
TimeInput 🔴 172.0 kB (+2.6 kB) · 16.4 kB CSS (0) — — · — · —
Popover 97.4 kB (+580 B) · 14.6 kB CSS (0) — — · — · —
SideNav 120.1 kB (+440 B) · 11.7 kB CSS (0) — — · — · —
TopNav 77.0 kB (+419 B) · 11.3 kB CSS (0) — — · — · —
MobileNav 75.3 kB (+416 B) · 11.0 kB CSS (0) — — · — · —
AlertDialog 111.0 kB (+407 B) · 15.0 kB CSS (0) — — · — · —
AppShell 96.6 kB (+395 B) · 13.8 kB CSS (0) — — · — · —
Dialog 25.3 kB (+376 B) · 6.9 kB CSS (0) — — · — · —
lab/CommentComposer 158.6 kB (+347 B) · 1.9 kB CSS (0) — — · — · —
Drawer 53.7 kB (+335 B) · 8.4 kB CSS (0) — — · — · —
lab/CommentThread 360.6 kB (+327 B) · 2.4 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 286.6 kB (+321 B) · 454 B CSS (0) — — · — · —
CommandPalette 76.2 kB (+320 B) · 12.7 kB CSS (0) — — · — · —
DropdownMenu 103.9 kB (+304 B) · 17.9 kB CSS (0) — — · — · —
MoreMenu 104.1 kB (+294 B) · 17.9 kB CSS (0) — — · — · —
lab/Comments 367.5 kB (+191 B) · 2.5 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 112.3 kB (+168 B) · 773 B CSS (0) — — · — · —
PowerSearch 303.9 kB (+165 B) · 24.7 kB CSS (0) — — · — · —
lab/ChatReactionBar 113.4 kB (+164 B) · 1.1 kB CSS (0) — — · — · —
lab/PageControl 78.0 kB (+49 B) · 709 B CSS (0) — — · — · —
MultiSelector 100.8 kB (+47 B) · 17.2 kB CSS (0) — — · — · —
TabMenu 78.1 kB (+7 B) · 11.5 kB CSS (0) — — · — · —
ButtonGroup 44.0 kB (+1 B) · 3.7 kB CSS (0) — — · — · —
NavHeadingMenu 18.5 kB (+1 B) · 3.5 kB CSS (0) — — · — · —
BreadcrumbItem 91.0 kB (0) · 12.5 kB CSS (0) — — · — · —
Lightbox 145.3 kB (0) · 11.5 kB CSS (0) — — · — · —
SegmentedControl 101.9 kB (0) · 6.9 kB CSS (0) — — · — · —
SideNavHeading 81.8 kB (0) · 11.7 kB CSS (0) — — · — · —
Switch 108.7 kB (0) · 10.0 kB CSS (0) — — · — · —
ToggleButton 91.4 kB (0) · 10.4 kB CSS (0) — — · — · —
ToggleButtonGroup 41.2 kB (0) · 3.7 kB CSS (0) — — · — · —
Tokenizer 103.1 kB (0) · 19.5 kB CSS (0) — — · — · —
TopNavMenu 80.8 kB (0) · 11.6 kB CSS (0) — — · — · —
lab/ChatVirtualizer 57.1 kB (0) · 223 B CSS (0) — — · — · —
lab/NavigationScreen 84.8 kB (0) · 1.5 kB CSS (0) — — · — · —
lab/NavigationStack 84.8 kB (0) · 1.5 kB CSS (0) — — · — · —
lab/TabBarItem 3.9 kB (0) · 1.8 kB CSS (0) — — · — · —
DropdownMenuSubMenu 74.3 kB (−1 B) · 10.1 kB CSS (0) — — · — · —
Slider 114.2 kB (−1 B) · 8.9 kB CSS (0) — — · — · —
TopNavHeading 81.5 kB (−2 B) · 11.6 kB CSS (0) — — · — · —
lab/TabBar 83.4 kB (−2 B) · 1.8 kB CSS (0) — — · — · —
Toast 102.7 kB (−3 B) · 10.6 kB CSS (0) — — · — · —
layer — — — · ✓ · —
Layer — — ✓ · ✓ · —
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
BottomSheet · Text Only (neutral, dark) before frame after frame diff frame
BottomSheet · Text Only (neutral, light) before frame after frame diff frame

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

Touched components checked; add ci:run-visual, ci:run-a11y 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 requested. Moving BottomSheet's exit onto the shared input hold keeps the sheet's inert and activation behavior, but it changes what a key pressed during the exit does.

Blocking

  • A key pressed while a closing sheet still holds focus no longer counts as keyboard input: holdKeptInside stops it on the window's capture phase (packages/core/src/Layer/inputHold.ts:585-592), ahead of the shared interaction-modality listener on the document, so after a mouse click on Done and Escape before the sheet has left, focus returns to the opener without the keyboard ring that main shows (architecture:interaction-modality INV1, and the changeset's "behaves as before"); please let the modality tracker still hear a swallowed key and add a test that pins it.

Three small comment suggestions are inline. They are not blocking. The layer-runtime record change is approved for this head, and the default 'blur' hold path is unchanged.

Claims and files checked
  • Changeset: a closing sheet now uses the shared hold's new kept-inside mode instead of its own exit rules. Verified (BottomSheet.tsx:884-894).
  • Changeset: the sheet behaves as before. False: a key pressed during the exit no longer sets keyboard modality (inputHold.ts:585-592).
  • Changeset: the page stays live. Verified for the hold, which adds no shield and no press hold (inputHold.ts:537-545). A modal sheet's page stays blocked by its dialog, as before.
  • Changeset and description: a sheet that keeps focus takes no click and no key but Tab. Verified (inputHold.test.tsx new case 2; BottomSheetCloseFocus.test.tsx).
  • Changeset and description: the sheet becomes inert and hidden once focus leaves, or at once when focus was never inside. Verified (new cases 3-4; BottomSheetCloseFocus.test.tsx cases for removed and moved focus).
  • Description: nothing changes for people closing a sheet. False, for the same reason as above.
  • Description: the exit now uses the runtime's one hold, so later fixes reach the sheet. Verified.
  • Description: the layer-runtime record listed two gaps, the sheet's own exit hold and no focus-keeping mode. Verified (base record).
  • Description: no shield, no window press hold, and pointers pass through the layer. Verified (inputHold.ts:537-545, new case 1).
  • Description: the default 'blur' hold, the entrance holds, Popover surface motion and DropdownMenu do not change. Verified: only an early return is added (inputHold.ts:435-437); their callers pass no focus.
  • Description: AlertDialog's leave rule and switcher steps stay on 'blur'. Accurate as a mapping: neither takes the new mode, and neither calls the hold today.
  • Description: the sheet's exit-focus state, watcher, capture handlers, pass-through style and exit-time inert go away; replaced and covered sheets keep their own inert. Verified (BottomSheet.tsx:873).
  • Description: the record names the new mode for FR9, drops both gap lines and the not-yet-met entry, and updates the verification row. Verified.
  • Description: four new hold tests fail on main and pass here, and a fifth pins 'blur'. Verified.
  • Description: the BottomSheet, Dialog, Drawer, Popover, DropdownMenu, MobileNav and hold suites pass unchanged. Verified.
  • Description: core typecheck, import boundaries, knowledge and changeset checks pass. Verified. The snap-paging bundle test was not rerun.
  • Description: the page and the closing sheet take pointers exactly as before. Verified (pointer-events: none for the whole held exit).
  • .changeset/bottom-sheet-shared-exit-hold.md: one false claim, above.
  • docs/architecture/layer-runtime.md: clear (approved for this head).
  • packages/core/src/BottomSheet/BottomSheet.tsx: clear; one inline comment suggestion.
  • packages/core/src/Layer/inputHold.ts: the blocking finding, plus two inline comment suggestions.
  • packages/core/src/Layer/inputHold.test.tsx: clear; the fix needs one more case.

Automated review (maintainer link)

Comment thread packages/core/src/Layer/inputHold.ts Resolved
Comment thread packages/core/src/Layer/inputHold.ts Resolved
Comment thread packages/core/src/Layer/inputHold.ts Resolved
…t listeners

The hold stopped a swallowed key on the window capture phase, ahead of the
shared interaction-modality tracker, so a key pressed while a closing sheet
kept focus did not count as keyboard input. It now stops keys and clicks at
the layer in the capture phase: document listeners still hear them, and
nothing inside the layer does. Comment tidy-ups from review.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 50c40ab

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The modality fix and the comment suggestions from the last review are in, but moving the stop onto the layer lets capture-phase handlers inside a closing sheet run again.

Blocking

  • During a closing sheet's exit, React onKeyDownCapture and onClickCapture handlers inside it run again, because the layer's own capture listeners fire after React's root capture dispatch (packages/core/src/Layer/inputHold.ts:563-585), so a DropdownMenu bottom-sheet link row selects a second time on a second activation and the changeset's "takes no click and no key but Tab" no longer holds (component:BottomSheet FR9); please stop the event before React's root listener while still letting the modality tracker hear the key, and add a BottomSheet case with inner capture handlers.
  • The description says the shared input stream stops clicks and keys during the exit, but at this head capture listeners on the layer do that (inputHold.ts:575-585); please update that line.

Two small notes are inline. The layer-runtime record change is approved for this head.

Claims and files checked
  • Changeset: a closing sheet now takes the shared hold's new kept-inside mode instead of its own exit rules. Verified (BottomSheet.tsx:879-889).
  • Changeset: the sheet behaves as before. False: capture-phase handlers inside the sheet hear keys and clicks during the exit (inputHold.ts:563-585).
  • Changeset: the page stays live. Verified: the hold adds no shield and no press hold, and the layer lets pointers through (first kept-inside case).
  • Changeset: a sheet that keeps focus takes no click and no key but Tab. False for capture-phase handlers; true for bubble-phase handlers (BottomSheetCloseFocus.test.tsx).
  • Changeset: the sheet is inert and hidden once focus leaves. Verified (kept-inside cases; BottomSheetCloseFocus.test.tsx).
  • Description: nothing changes for people closing a sheet. False, for the capture-phase reason above.
  • Description: the exit uses the runtime's one hold, so later fixes reach the sheet. Verified.
  • Description: the record listed two gaps, the sheet's own exit hold and no focus-keeping mode. Verified (base record).
  • Description: no viewport shield, no window press hold, and every pointer passes through the layer. Verified (inputHold.ts:529-537, first kept-inside case).
  • Description: the shared input stream stops every click and every key but Tab. False: capture listeners on the layer do (inputHold.ts:575-585).
  • Description: when focus leaves (moved, removed, disabled, hidden or made inert) or was not inside, the layer becomes inert and hidden until the hold ends. Verified (kept-inside cases; BottomSheetCloseFocus.test.tsx).
  • Description: the default 'blur' hold, the entrance and presentation holds, Popover surface motion and DropdownMenu do not change. Verified: only an early return is added (inputHold.ts:435-437) and their callers pass no focus.
  • Description: AlertDialog's leave rule and switcher steps stay on 'blur'. Accurate as a mapping: neither takes the new mode.
  • Description: the sheet's exit-focus state, watcher, capture handlers, pass-through style and exit-time inert go away; replaced and covered sheets keep their own inert. Verified (BottomSheet.tsx:873).
  • Description: the record names the new mode for FR9, drops both gap lines and the not-yet-met entry, and updates the verification row. Verified.
  • Description: four new hold cases fail on main and pass here, and a fifth pins 'blur'. Verified: the kept-inside cases fail on main and the 'blur' case passes on both.
  • Description: the BottomSheet, Dialog, Drawer, Popover, DropdownMenu, MobileNav and hold suites pass. Verified: 59 files, 1,548 tests at this head.
  • Description: core typecheck, import boundaries, knowledge, changeset checks and the snap-paging bundle test pass. Verified.
  • Description: the page and the closing sheet take pointers exactly as before. Verified (pointer-events: none for the whole held exit on both sides).
  • .changeset/bottom-sheet-shared-exit-hold.md: two false claims, in the first blocking finding.
  • docs/architecture/layer-runtime.md: clear (approved for this head).
  • packages/core/src/BottomSheet/BottomSheet.tsx: clear.
  • packages/core/src/Layer/inputHold.ts: the first blocking finding, plus one comment suggestion.
  • packages/core/src/Layer/inputHold.test.tsx: clear; one naming note, and the fix needs a case.

Automated review (maintainer link)

Comment thread packages/core/src/Layer/inputHold.ts Resolved
Comment thread packages/core/src/Layer/inputHold.ts Resolved
At the layer, the stop ran after React root capture dispatch, so capture
handlers inside a closing sheet ran again. The hold now stops a key or a
click that targets the layer on the document capture phase: the
interaction-modality tracker, which listens there from the first
consumer mount, still hears it, and React root and the layer do not.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 38e0742

@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; it runs once the pull request is marked ready for review.

Moving the stop to the document's capture phase fixes the earlier finding: capture-phase handlers inside a closing sheet stay silent during its exit, as on main, and the modality tracker still hears the key. The layer-runtime record change is approved for this head. Two non-blocking notes are inline: code around a closing sheet (React capture handlers written around it, and document listeners added after the hold starts) no longer hears a key or click aimed at the sheet, and one comment could be reworded.

Claims and files checked
  • Changeset: a closing sheet now takes the shared hold's new kept-inside mode instead of its own exit rules. Verified (BottomSheet.tsx:879-889).
  • Changeset: the sheet behaves as before. Verified for the sheet: capture handlers inside it hear nothing during the exit on main and here, in Chromium and jsdom; code around the sheet is the inline note.
  • Changeset: the page stays live. Verified: no shield and no press hold, and the layer lets pointers through (first kept-inside case).
  • Changeset: a sheet that keeps focus takes no click and no key but Tab. Verified (inputHold.ts:574-595; the new BottomSheetCloseFocus.test.tsx case).
  • Changeset: the sheet is inert and hidden once focus leaves. Verified (kept-inside cases; BottomSheetCloseFocus.test.tsx).
  • Description: nothing changes for people closing a sheet or using the page around it. Verified for people; code around the sheet is the inline note.
  • Description: the exit uses the runtime's one hold, so later fixes reach the sheet. Verified.
  • Description: the record listed two gaps, the sheet's own exit hold and no focus-keeping mode. Verified (base record).
  • Description: no viewport shield and no window press hold, every pointer passes through the layer, and a tap on the page acts. Verified (inputHold.ts:531-535; first kept-inside case).
  • Description: the document's capture phase stops every click and every key but Tab that targets the layer. Verified (inputHold.ts:567-595).
  • Description: the modality tracker listens there from its first consumer's mount and still hears the key, so focus returns with the keyboard ring. Verified (interactionModality.ts:143-150, :250-252; jsdom, and the opener matches :focus-visible in Chromium).
  • Description: React's root and capture handlers inside the sheet do not hear it. Verified.
  • Description: when focus leaves (moved, removed, disabled, hidden or made inert) or was not inside, the layer becomes inert and hidden until the hold ends. Verified (inputHold.ts:550-561, :596-616; kept-inside cases).
  • Description: the default blur hold, the entrance and presentation holds, Popover surface motion and DropdownMenu do not change. Verified: only an early return is added (inputHold.ts:435-437) and the other callers pass no focus.
  • Description: AlertDialog's leave rule and switcher steps stay on blur. Accurate in effect: neither takes the new mode.
  • Description: the sheet's own exit state, focus watcher, capture handlers, pass-through style and exit-time inert go away; replaced and covered sheets keep their own inert. Verified (BottomSheet.tsx:873).
  • Description: the record names the new mode as the sheet's exit mechanism, drops both gap lines and the not-yet-met entry, and updates the verification row. Verified.
  • Description: four new hold cases fail on main and pass here, and a fifth pins blur. Verified: the five kept-inside cases fail on main and the blur case passes on both.
  • Description: a document listener added before the hold hears a swallowed key, and no capture handler inside a closing sheet runs; the sheet case fails on the earlier head. Verified.
  • Description: the BottomSheet, Dialog, Drawer, Popover, DropdownMenu, MobileNav and hold suites pass. Verified: 59 files and 1,549 tests at this head (the description's tally says 1,547).
  • Description: core typecheck, import boundaries, knowledge and changeset checks and the snap-paging bundle test pass. Verified.
  • Description: the page and the closing sheet take pointers exactly as before. Verified (pointer-events: none for the whole held exit on both).
  • Description, writing rubric: present tense, one topic per sentence, each sentence of the record change maps to a named test, and no duplicated owner. Verified: the kept-inside sentences map to the hold cases the verification row names.
  • .changeset/bottom-sheet-shared-exit-hold.md: clear.
  • docs/architecture/layer-runtime.md: clear (approved for this head).
  • packages/core/src/BottomSheet/BottomSheet.tsx: clear.
  • packages/core/src/BottomSheet/BottomSheetCloseFocus.test.tsx: clear.
  • packages/core/src/Layer/inputHold.test.tsx: clear.
  • packages/core/src/Layer/inputHold.ts: two non-blocking notes, inline.

Automated review (maintainer link)

Comment on lines +563 to +566
// Stopped on the document's capture phase. The interaction-modality
// tracker listens there from the first consumer's mount, before any hold,
// so it still hears the key. React's root and everything inside the layer
// do not, capture handlers included.

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 first sentence is a passive fragment. Suggest:

// The hold listens on the document's capture phase. The modality tracker
// listens there from its first consumer's mount, before any hold, so it
// hears the key first. React's root and the layer never hear it.

['keyup', stopKey],
];
for (const [type, listener] of captures) {
doc.addEventListener(type, listener, {capture: true});

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: stopping here also keeps a swallowed key or click from code around the sheet: React capture handlers written around a BottomSheet, body and html capture listeners, and document capture listeners added after the hold starts. On main they heard it; in Chromium an onKeyDownCapture around a closing sheet heard keydown x, keydown Enter, click on main and nothing here. The modality guarantee also rests on the tracker registering first. Consider saying both in the focus JSDoc or INV16, so a document listener that installs lazily, such as the gesture counter's (gestureCounter.ts:91-93), is a known case.

# Conflicts:
#	docs/architecture/layer-runtime.md
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a27b533

@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. CI passes on this head.

A closing sheet still behaves as on main: no click and no key but Tab reaches it while it keeps focus, it goes inert and hidden once focus leaves, and focus returns with the keyboard ring; the layer-runtime record change is approved for this head. Three non-blocking notes are inline: code around a closing sheet (React capture handlers written around it, and document listeners added after the hold starts) no longer hears a key or click aimed at the sheet, and two comments could be reworded.

Claims and files checked
  • Changeset: a closing sheet takes the shared hold's new kept-inside mode instead of its own exit rules. Verified (BottomSheet.tsx:879-889).
  • Changeset: the sheet behaves as before: the page stays live, a sheet that keeps focus takes no click and no key but Tab, and it goes inert and hidden once focus leaves. Verified: browser checks on main and this head match (inputHold.ts:529-535, :574-595, :596-616).
  • Description: nothing changes for people closing a sheet with focus inside or using the page around it. Verified for people; code around the sheet is the non-blocking note.
  • Description: the exit uses the runtime's one hold, so later fixes reach the sheet. Verified: one holdInput call and no sheet-local listener.
  • Description: the layer-runtime record listed two gaps, the sheet's own exit hold and no focus-keeping mode. Verified (record on main).
  • Description: the new mode raises no viewport shield or window press hold and lets every pointer through the layer, so taps on the page and on the closing sheet act as today. Verified (inputHold.ts:435-437, :531-535; first new hold test).
  • Description: while focus stays inside, the content stays exposed and the document's capture phase stops every click and every key but Tab aimed at the layer. Verified (inputHold.ts:563-595; second new hold test).
  • Description: the modality tracker listens on the document from its first consumer's mount, still hears the key, and focus returns with the keyboard ring. Verified (interactionModality.ts:147, :252; the opener shows the ring after the exit in Chromium).
  • Description: React's root and capture handlers inside the sheet do not hear the stopped key or click. Verified (capture-handler test in BottomSheetCloseFocus.test.tsx).
  • Description: when focus leaves (moved, removed, disabled, hidden or made inert) or was not inside, the layer goes inert and hidden until the hold ends. Verified (inputHold.ts:560-561, :596-616; hold tests; Chromium removed-control check).
  • Description: the default blur dismissal and the Dialog, Drawer, MobileNav, presentation, Popover and DropdownMenu holds do not change. Verified: only an early return is added (inputHold.ts:435-437) and the other callers pass no focus.
  • Description: AlertDialog and switcher steps stay on the blur-style dismissal. Verified as record text; neither calls the hold.
  • Description: the file-by-file list of changes, including that replaced and covered sheets keep their own inert. Verified against the diff (BottomSheet.tsx:873-874).
  • Description: the record names the mode, removes both gap lines and the not-yet-met entry, and updates the verification row. Verified against the diff.
  • Description: a chore changeset. Verified.
  • Description: four new hold tests fail on main and pass here, and a fifth pins the blur dismissal. Verified: five kept-inside cases fail on main (the fifth is the document-listener case listed under review rounds) and the blur case passes on both.
  • Description: a document listener added before the hold hears a swallowed key, and no capture handler inside a closing sheet runs. Verified (both tests pass here).
  • Description: one capture case covers every row kind because the stop comes before React's root, and a second activation of an action-sheet row selects nothing. Verified by the mechanism and in Chromium (a second Enter selected nothing on both sides).
  • Description: the listed suites pass. Verified: 131 files and 3,226 tests across those suites and the gesture, menu-press and AlertDialog suites pass at this head.
  • Description: typecheck, import boundaries, knowledge, changeset and snap-paging bundle checks pass. Verified.
  • Description: no feel change; pointers behave as before. Verified: the closing sheet lets pointers through on both sides.
  • Description: each record sentence maps to a named test. Verified: the verification row names the kept-inside cases and BottomSheetCloseFocus.test.tsx.
  • Files: .changeset/bottom-sheet-shared-exit-hold.md clear; docs/architecture/layer-runtime.md clear; packages/core/src/BottomSheet/BottomSheet.tsx one non-blocking comment note; packages/core/src/BottomSheet/BottomSheetCloseFocus.test.tsx clear; packages/core/src/Layer/inputHold.test.tsx clear; packages/core/src/Layer/inputHold.ts two non-blocking notes.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 13, 2026 07:34
@cixzhang
cixzhang merged commit 248de60 into main Nov 13, 2026
138 checks passed
@cixzhang
cixzhang deleted the l0/hold-kept-inside branch November 13, 2026 20:45

This branch was successfully deployed

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

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