Repository navigation
fix(BottomSheet): a sheet whose close is suspended takes the scrim - #10776
Conversation
A sheet chose its scrim from a ref of its open state written during render. A transition that closes the sheet and then suspends leaves the sheet open on screen, with that ref false. If the sheet beneath it closed meanwhile, the open sheet did not take over the dim, so the page behind it lost its dim until the transition ended. The ref is now written at commit, in an insertion effect, so every layout effect of the commit reads it, a nested sheet's registry call included. A new stacking case closes the top sheet in a transition that suspends for good, then closes the sheet beneath it from code. It fails on main and passes here; the same case without the transition passes on both.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| BottomSheet | 68.3 kB (+9 B) · 7.7 kB CSS (0) | — | ✗ · ✓ · — |
| BottomSheetSwitcher | 17.9 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| PowerSearch | 287.3 kB (+22 B) · 24.1 kB CSS (0) | — | — · — · — |
22 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateTimeInput | 208.7 kB (+13 B) · 18.7 kB CSS (0) | — | — · — · — |
| TimeInput | 162.5 kB (+13 B) · 16.0 kB CSS (0) | — | — · — · — |
| DateInput | 187.0 kB (+10 B) · 17.0 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 344.5 kB (+3 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 106.1 kB (+2 B) · 773 B CSS (0) | — | — · — · — |
| Markdown | 187.7 kB (+1 B) · 20.6 kB CSS (0) | — | — · — · — |
| MultiSelector | 94.9 kB (+1 B) · 16.8 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 152.1 kB (+1 B) · 1.9 kB CSS (0) | — | — · — · — |
| ContextMenu | 108.4 kB (0) · 17.4 kB CSS (0) | — | — · — · — |
| DropdownMenu | 97.3 kB (0) · 17.6 kB CSS (0) | — | — · — · — |
| MoreMenu | 97.5 kB (0) · 17.6 kB CSS (0) | — | — · — · — |
| Pagination | 110.0 kB (0) · 17.8 kB CSS (0) | — | — · — · — |
| Selector | 99.9 kB (0) · 17.4 kB CSS (0) | — | — · — · — |
| Table | 125.0 kB (0) · 18.3 kB CSS (0) | — | — · — · — |
| TableCell | 109.7 kB (0) · 17.9 kB CSS (0) | — | — · — · — |
| Tokenizer | 91.5 kB (0) · 18.8 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 107.3 kB (0) · 1.1 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 278.2 kB (0) · 454 B CSS (0) | — | — · — · — |
| TableHeaderCell | 109.2 kB (−1 B) · 17.7 kB CSS (0) | — | — · — · — |
| lab/TourStep | 97.4 kB (−1 B) · 590 B CSS (0) | — | — · — · — |
| Popover | 91.1 kB (−2 B) · 14.2 kB CSS (0) | — | — · — · — |
| lab/Comments | 351.3 kB (−3 B) · 2.5 kB CSS (0) | — | — · — · — |
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.21 MB packed (+225 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 36 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.
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.
Approved pending CI: CI has not run on this head yet. This is a draft from a fork, so CI runs once it is marked ready for review and a maintainer adds the ci:run label.
Writing isOpenRef at commit restores BottomSheet's single page dim when a stacked sheet's close waits in a suspended transition and the sheet beneath it closes; the new stacking case fails on main and passes here.
Two non-blocking notes: the inline suggestion rewords the comment above the insertion effect in active voice, and no test yet pins the insertion-effect timing over a layout effect for the nested-sheet case that comment describes.
[Automated review]
| // Written at commit: a render React discards, as a suspended transition | ||
| // does, must not change the scrim. The insertion effect runs before any | ||
| // layout effect, so a nested sheet's registry call in the same commit sees | ||
| // the new state too. |
There was a problem hiding this comment.
Non-blocking: this comment opens with a passive fragment ("Written at commit:"). A wording in active voice, one topic per sentence:
| // Written at commit: a render React discards, as a suspended transition | |
| // does, must not change the scrim. The insertion effect runs before any | |
| // layout effect, so a nested sheet's registry call in the same commit sees | |
| // the new state too. | |
| // A render that React discards, such as a suspended transition, must not | |
| // change the scrim. So the ref changes at commit, before any layout | |
| // effect. A nested sheet's registry call in that commit then reads the | |
| // new value. |
No test pins the second half yet: with useLayoutEffect here, every BottomSheet test still passes.
|
/approve-spec b0cc450 |






User impact
A stack of
BottomSheets dims the page through its bottom sheet. An app can close the top sheet in a transition that suspends, as a navigation waiting on data does. The top sheet then stays open on screen. If the sheet beneath it closes in that time, the dim goes with it. The page behind the open modal sheet loses its dim while the close transition waits.Problem and solution fit
isOpenis a controlled prop; no callback in the sheet owns its change, so the ref is written at commit. Other refs in Core are still written during render; this change fixes only this one.Expected behavior and authority
component:BottomSheetFR6: "Exactly one backdrop is visible for a stack — the bottom open sheet's — and a change of scrim owner lands with no transition, so the page dim is constant through a push, a pop, and a handoff."Smallest restoration
In
BottomSheet/BottomSheet.tsx, an insertion effect writesisOpenRef. A nested sheet's layout effects run before its host's, and their registry call can reach the host'sonView. An insertion effect runs before every layout effect, as ComplexSelector'sisDisabledRefand #10162's Chat refs do. No API changes.Evidence
expected '0' to be '1').Scope
Testing
BottomSheetStacking.test.tsxfails on main and passes here. The stacking suite passed three times (87 tests).vitest relatedforBottomSheet.tsx: 206 files, 6,115 tests.pnpm -F @astryxdesign/core typecheck: 0 errors. ESLint and Prettier on the changed files, the comment-provenance check,pnpm check:changesetsand changeset coverage pass.