Repository navigation
fix(Layer): a released kept-inside hold never makes its layer inert - #11684
Conversation
The hold reads focus a microtask after focusout. A release in the same task ran first, and the queued check then set inert and aria-hidden on the layer with nothing to remove them, so a BottomSheet opened again could not take focus or input.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 40a8fbf |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| BottomSheetSwitcher | 18.7 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | ✓ · ✓ · ✗ |
| BottomSheet | 73.0 kB (−3 B) · 7.7 kB CSS (0) | — | ✗ · ✓ · — |
66 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/CommentThread | 361.5 kB (+11 B) · 2.4 kB CSS (0) | — | — · — · — |
| MoreMenu | 107.0 kB (+5 B) · 18.6 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 35.1 kB (+2 B) · 6.9 kB CSS (0) | — | — · — · — |
| CommandPalette | 79.1 kB (+1 B) · 12.7 kB CSS (0) | — | — · — · — |
| DateTimeInput | 223.3 kB (+1 B) · 19.7 kB CSS (0) | — | — · — · — |
| Drawer | 53.9 kB (+1 B) · 8.4 kB CSS (0) | — | — · — · — |
| Pagination | 123.6 kB (+1 B) · 18.9 kB CSS (0) | — | — · — · — |
| PowerSearch | 306.1 kB (+1 B) · 25.5 kB CSS (0) | — | — · — · — |
| lab/Comments | 368.9 kB (+1 B) · 2.5 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 96.2 kB (0) · 13.1 kB CSS (0) | — | — · — · — |
| ButtonGroup | 44.1 kB (0) · 3.7 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 79.6 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 28.3 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 27.5 kB (0) · 6.8 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 28.4 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 79.1 kB (0) · 10.3 kB CSS (0) | — | — · — · — |
| Item | 20.3 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| Lightbox | 145.2 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| ListItem | 78.8 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| Markdown | 201.9 kB (0) · 21.7 kB CSS (0) | — | — · — · — |
| NavHeadingMenu | 18.5 kB (0) · 3.5 kB CSS (0) | — | — · — · — |
| Popover | 98.4 kB (0) · 15.1 kB CSS (0) | — | — · — · — |
| RadioListItem | 75.8 kB (0) · 10.5 kB CSS (0) | — | — · — · — |
| SegmentedControl | 102.0 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| SelectorOption | 23.8 kB (0) · 6.6 kB CSS (0) | — | — · — · — |
| SideNavHeading | 82.3 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| Slider | 114.3 kB (0) · 8.9 kB CSS (0) | — | — · — · — |
| Switch | 108.8 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| TabMenu | 78.7 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| Toast | 103.5 kB (0) · 11.1 kB CSS (0) | — | — · — · — |
| ToggleButton | 91.9 kB (0) · 10.9 kB CSS (0) | — | — · — · — |
| ToggleButtonGroup | 41.3 kB (0) · 3.7 kB CSS (0) | — | — · — · — |
| Tokenizer | 103.5 kB (0) · 20.1 kB CSS (0) | — | — · — · — |
| TopNavHeading | 81.9 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| TopNavMenu | 81.3 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| lab/ChatVirtualizer | 57.2 kB (0) · 223 B CSS (0) | — | — · — · — |
| lab/CommentComposer | 162.5 kB (0) · 1.9 kB CSS (0) | — | — · — · — |
| lab/NavigationScreen | 84.9 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 84.9 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/PageControl | 78.1 kB (0) · 709 B CSS (0) | — | — · — · — |
| lab/TabBar | 83.5 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 101.6 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TransferList | 111.8 kB (0) · 1.2 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 120.6 kB (0) · 1.4 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 299.3 kB (0) · 454 B CSS (0) | — | — · — · — |
| AlertDialog | 128.5 kB (−1 B) · 15.4 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 121.3 kB (−1 B) · 18.7 kB CSS (0) | — | — · — · — |
| TimeInput | 174.6 kB (−1 B) · 16.9 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 113.3 kB (−1 B) · 773 B CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 114.4 kB (−1 B) · 1.1 kB CSS (0) | — | — · — · — |
| AppShell | 97.4 kB (−2 B) · 14.3 kB CSS (0) | — | — · — · — |
| DateInput | 199.8 kB (−2 B) · 17.9 kB CSS (0) | — | — · — · — |
| MultiSelector | 101.3 kB (−2 B) · 17.7 kB CSS (0) | — | — · — · — |
| Selector | 112.6 kB (−2 B) · 18.5 kB CSS (0) | — | — · — · — |
| TableCell | 121.6 kB (−2 B) · 18.9 kB CSS (0) | — | — · — · — |
| TopNav | 77.9 kB (−2 B) · 11.7 kB CSS (0) | — | — · — · — |
| ContextMenu | 120.3 kB (−3 B) · 18.4 kB CSS (0) | — | — · — · — |
| SideNav | 121.1 kB (−3 B) · 12.2 kB CSS (0) | — | — · — · — |
| lab/Schedule | 114.5 kB (−3 B) · 3.9 kB CSS (0) | — | — · — · — |
| MobileNav | 76.1 kB (−4 B) · 11.4 kB CSS (0) | — | — · — · — |
| Table | 138.5 kB (−4 B) · 19.4 kB CSS (0) | — | — · — · — |
| Dialog | 25.5 kB (−5 B) · 6.9 kB CSS (0) | — | — · — · — |
| DropdownMenu | 106.8 kB (−5 B) · 18.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) | ![]() |
![]() |
![]() |
| BottomSheet · Text Only (neutral, light) | ![]() |
![]() |
![]() |
Package size: @astryxdesign/core 7.58 MB packed (+114 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
There was a problem hiding this comment.
Changes requested: the guard is sound and both new tests fail before it and pass with it, but the release note describes a failure people did not see.
- The changeset (
.changeset/kept-inside-hold-release.md) and the description's "Who" and "Before" lines say a BottomSheet opened again after closing stayedinertand out of reach since 0.7.16, yet onmaina modal sheet (mouse, reduced motion and touch) and the Selector bottom-sheet picker reopen usable with focus inside in Chromium, and in Firefox too, so please reword both to the race the tests reproduce: a release that lands between afocusoutand its queued focus check, as when the exit and the focus return commit in one task underact().
A suggested changeset wording is on the changeset line, and an optional wording note on the new source comment is inline.
Claims and files checked
- The hold reads focus a microtask after
focusout, and before this change a check queued before the release could run after it and leave the layer inert: verified (inputHold.ts:606; the new test fails without the fix). - Nothing removed those attributes afterwards: verified (
release()had already run,inputHold.ts:622-641). - Only
holdKeptInsidechanges, and both the focus check and the subtree watch go throughmakeInert, which now returns once released: verified (inputHold.ts:554,:599-619). - The new
inputHoldtest fails onmainand passes here: verified. - The new BottomSheet reopen test fails on
mainand passes here: verified (fails atBottomSheetCloseFocus.test.tsx:302). - The layer-runtime record's input-hold rule decides the behavior: verified as a fair reading (the hold's inert applies while the layer dismisses).
- The unguarded code shipped in 0.7.16: verified in the published package.
- A reopened sheet was unusable for people in 0.7.16, including a touch picker: false in Chromium and Firefox on
main(finding above). - After the change the sheet opens again fully usable: verified (tests and browser probes).
- Fixes the linked issue: verified (its reproduction is the new
inputHoldtest and its suggested guard is the fix). - One function, two tests and a changeset: verified.
- No internal context in public text: verified.
- Changeset, first sentence (a reopened sheet takes focus and input): true after the change, but it already did in browsers (finding above).
- Changeset, second sentence (the closing hold could leave the sheet inert and hidden): true only when the exit commits in the same task as the focus return.
.changeset/kept-inside-hold-release.md: finding above.packages/core/src/Layer/inputHold.ts: clear (optional comment wording).packages/core/src/Layer/inputHold.test.tsx: clear.packages/core/src/BottomSheet/BottomSheetCloseFocus.test.tsx: clear.
| // A focus check queued before the release can run after it. A released hold | ||
| // changes the layer no more. |
There was a problem hiding this comment.
Optional: "changes the layer no more" is an idiom. A plainer version that keeps the reason:
// A focus check queued before the release can run after it. Then it must not
// change the layer.|
/approve-spec b0fe991 |
There was a problem hiding this comment.
Approved pending CI: the guard is sound, both new tests fail without it and pass with it, and the changeset now describes the race those tests reproduce. CI has not run its required checks on this head yet, because the CI workflow stopped with "CI is full"; re-run it (or push again) so build and tests run. The optional wording note on the new source comment in inputHold.ts still stands.
Claims and files checked
- Changeset: a released input hold no longer changes its layer: verified (
inputHold.ts:554; only the kept-inside hold ever wrote its layer after a release). - Changeset: a closing BottomSheet's hold reads focus shortly after focus leaves the sheet: verified (
inputHold.ts:606,BottomSheet.tsx:888-892). - Changeset: a release in between could leave the sheet inert and hidden from assistive technology: verified (both new tests fail on
main). - Changeset and description: no browser flow is known to hit it: consistent with the evidence; a modal sheet and the Selector bottom-sheet picker reopen usable on
mainin Chromium and Firefox; iOS Safari was not checked here. - The hold reads focus a microtask after each
focusout: verified (inputHold.ts:606). - A release between a
focusoutand its queued read leavesinertandaria-hiddenwith nothing to remove them: verified onmain(the newinputHoldtest fails atinputHold.test.tsx:1084). - The sheet opened again could then not take focus or input: verified in the test environment (the reopened sheet carries
inert,BottomSheetCloseFocus.test.tsx:302). - After the change a released hold never changes the layer, whatever the order: verified (
makeInertis the hold's only layer write and returns once released,inputHold.ts:553-561). - Fixes the linked issue: verified (its reproduction is the new
inputHoldtest and its suggested guard is the fix). - A closing BottomSheet takes a kept-inside hold: verified (
BottomSheet.tsx:888-892). - Only
holdKeptInsidechanges, and the queued check and the subtree watch both go throughmakeInert: verified (inputHold.ts:599-619). - Both new tests fail on
mainand pass here: verified. - The layer runtime's input-hold rule decides the behavior: verified as a fair reading (the hold's inert applies while the layer dismisses).
- One function, two tests and a changeset: verified.
- Public text contains no internal context: verified.
.changeset/kept-inside-hold-release.md: clear.packages/core/src/Layer/inputHold.ts: clear (optional comment wording).packages/core/src/Layer/inputHold.test.tsx: clear.packages/core/src/BottomSheet/BottomSheetCloseFocus.test.tsx: clear.
|
/approve-spec c680de8 |
There was a problem hiding this comment.
Approved: the guard in holdKeptInside is sound, both new tests fail without it and pass with it, and the changeset matches the race those tests reproduce. CI passed on this head. The optional wording note on the new source comment in inputHold.ts still stands.
Claims and files checked
Review mode: same-head; reason: none
- Changeset: a released input hold no longer changes its layer: verified (
inputHold.ts:586; the other hold kinds write their layer only while holding or releasing). - Changeset: a closing BottomSheet's hold reads focus shortly after focus leaves the sheet: verified (
inputHold.ts:638,BottomSheet.tsx:888-892). - Changeset: a release in between could leave the sheet inert and hidden from assistive technology: verified (both new tests fail on
main). - Changeset and description: no browser flow is known to hit it: consistent with the evidence; a modal sheet and the Selector bottom-sheet picker reopen usable on
mainin Chromium and Firefox; the iOS Safari result is the author's and was not checked here. - The hold reads focus a microtask after each focus loss: verified (
inputHold.ts:638). - A release between a focus loss and its queued read leaves the sheet inert and hidden with nothing to remove them: verified on
main(the new hold test fails atinputHold.test.tsx:1180). - The sheet opened again could then not take focus or input: verified in the test environment (the reopened sheet carries
inert,BottomSheetCloseFocus.test.tsx:302). - After the change a released hold never changes the layer, whatever the order: verified (
inputHold.ts:586, andrelease()restores only what the hold set,inputHold.ts:663-672). - Fixes the linked issue: verified (its reproduction is the new hold test and its suggested guard is the fix).
- Only
holdKeptInsidechanges, and the queued check and the subtree watch both go throughmakeInert: verified (inputHold.ts:631-651). - Both new tests fail on
mainand pass here: verified. - The layer runtime's input-hold rule decides the behavior: verified as a fair reading (the hold marks the layer only while the layer dismisses).
- One function, two tests and a changeset: verified.
- Public text contains no internal context: verified.
- The land path waits on #8373: satisfied, it is on
main. - Changed review rule, the review mode stated in plain text with no hidden comment: checked: this comment; no finding.
- Changed review rule, the limits on a narrowed re-review: checked: the three rules changed since the last review; no finding.
- Changed review rule, the reasons for a full review: checked: this review's mode; no finding.
.changeset/kept-inside-hold-release.md: clear.packages/core/src/Layer/inputHold.ts: clear (optional comment wording).packages/core/src/Layer/inputHold.test.tsx: clear.packages/core/src/BottomSheet/BottomSheetCloseFocus.test.tsx: clear.






User impact
focusout. If the hold is released between afocusoutand that queued read, for example when the exit ends and focus returns to the trigger in one task, the read runs on a released hold and setsinertandaria-hiddenon the sheet with nothing to remove them. The sheet opened again could then not take focus or input. The tests below reproduce that order. No browser flow is known to hit it today: in Chromium, Firefox and iOS Safari a reopened modal sheet and the Selector sheet stay usable.Fixes #11646. Thanks to @jimmyallinai, who looked into #11646.
Why
A closing BottomSheet takes a
'kept-inside'input hold. The hold reads focus a microtask after eachfocusout. When focus returned to the trigger and the hold was released in the same task, that queued check ran after the release, found focus outside, and setinertandaria-hiddenon the layer. Nothing removed them again.What changed
Layer/inputHold.ts,holdKeptInsideonly: a released hold changes the layer no more. The queued focus check and the subtree watch both go throughmakeInert, which now returns once the hold is released.[fix]changeset.Evidence
inputHold.test.tsx"leaves the layer usable when its focus check runs after the release": the reporter's case. Focus inside, hold, move focus out, release in the same task, flush microtasks; the layer has noinertoraria-hidden. Fails on main, passes here.BottomSheetCloseFocus.test.tsx"opens again usable after a close that returned focus to the opener": close the sheet from inside, let the exit end, open it again; the sheet is open with noinertoraria-hidden. Fails on main, passes here.architecture:layer-runtimeINV16 (current) decides the behavior: a released hold changes nothing.Scope
Owner: Astryx fix-loop lane 0. Land path: CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue (after #8373).