Repository navigation
fix(BottomSheet): a flick's close clears the scrim along the same spring - #11400
Conversation
spec:AST-108 FR4a says a sheet and its scrim start and land together. Under a touch flick, the scrim's fade took the close spring's settle time but kept the stylesheet's standard ease. The spring is front-loaded, and its settle time includes a long sub-pixel tail, so on an iPhone and a Pixel the sheet was gone in about 0.13 s with the scrim 15-20 % faded, and the scrim kept fading for about 0.5-0.7 s more. The host now writes the close's progress as CSS linear() easing beside its duration (--_sheet-scrim-easing), so the scrim's opacity follows the sheet's position on every frame. resolveMoveTiming in motion/resolveMotion gives a move's duration and its progress easing; motion/linearEasing samples a curve as linear() text, shared with animatedLayout's release glides. Reduced motion, the stack's 0s pin, and every other close are unchanged. Tests: the scrim's easing tracks the close spring at several points of the close; the easing clears with the duration; resolveMoveTiming follows the animator's curve at a theme tempo. The first two fail on main. Real-device evidence: vjeux's iPhone and Pixel farm, via the Motion & Gestures lane.
|
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 | 72.9 kB (+165 B) · 7.7 kB CSS (+15 B) | — | ✗ · ✓ · — |
| BottomSheetSwitcher | 18.7 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| TimeInput | 174.0 kB (+173 B) · 16.4 kB CSS (+22 B) | — | — · — · — |
41 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput | 199.2 kB (+169 B) · 17.5 kB CSS (+22 B) | — | — · — · — |
| PowerSearch | 305.7 kB (+153 B) · 24.7 kB CSS (+24 B) | — | — · — · — |
| DateTimeInput | 222.6 kB (+149 B) · 19.2 kB CSS (+26 B) | — | — · — · — |
| Popover | 97.4 kB (+121 B) · 14.6 kB CSS (+19 B) | — | — · — · — |
| lab/ChatReactionBar | 113.4 kB (+137 B) · 1.1 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 112.3 kB (+123 B) · 773 B CSS (0) | — | — · — · — |
| lab/CommentComposer | 158.6 kB (+120 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 360.3 kB (+112 B) · 2.4 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 297.4 kB (+101 B) · 454 B CSS (0) | — | — · — · — |
| lab/Comments | 367.1 kB (+87 B) · 2.5 kB CSS (0) | — | — · — · — |
| Table | 135.2 kB (+25 B) · 18.7 kB CSS (+24 B) | — | — · — · — |
| ContextMenu | 117.1 kB (+14 B) · 17.8 kB CSS (+22 B) | — | — · — · — |
| TableCell | 118.3 kB (+10 B) · 18.3 kB CSS (+22 B) | — | — · — · — |
| Markdown | 198.2 kB (+6 B) · 21.1 kB CSS (+20 B) | — | — · — · — |
| TableHeaderCell | 117.9 kB (−10 B) · 18.0 kB CSS (+22 B) | — | — · — · — |
| CheckboxList | 73.0 kB (+9 B) · 7.8 kB CSS (0) | — | — · — · — |
| TreeList | 46.2 kB (+8 B) · 5.9 kB CSS (0) | — | — · — · — |
| List | 19.0 kB (+7 B) · 790 B CSS (0) | — | — · — · — |
| lab/TransferList | 107.2 kB (+5 B) · 1.2 kB CSS (0) | — | — · — · — |
| ChatLayout | 87.7 kB (+1 B) · 10.9 kB CSS (0) | — | — · — · — |
| Lightbox | 144.7 kB (0) · 11.5 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.9 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| SegmentedControl | 101.8 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| Slider | 114.3 kB (0) · 8.9 kB CSS (0) | — | — · — · — |
| Switch | 108.7 kB (0) · 10.0 kB 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/PageControl | 78.0 kB (0) · 709 B CSS (0) | — | — · — · — |
| lab/TabBar | 83.4 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| SideNav | 120.1 kB (−5 B) · 11.7 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 116.0 kB (−7 B) · 1.4 kB CSS (0) | — | — · — · — |
| Collapsible | 28.9 kB (−10 B) · 4.5 kB CSS (0) | — | — · — · — |
| AppShell | 96.6 kB (−16 B) · 13.8 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 97.4 kB (−21 B) · 1.8 kB CSS (0) | — | — · — · — |
| DropdownMenu | 103.8 kB (−53 B) · 18.0 kB CSS (+22 B) | — | — · — · — |
| MultiSelector | 100.7 kB (−57 B) · 17.2 kB CSS (+22 B) | — | — · — · — |
| Tokenizer | 103.0 kB (−59 B) · 19.6 kB CSS (+20 B) | — | — · — · — |
| Pagination | 120.5 kB (−68 B) · 18.2 kB CSS (+22 B) | — | — · — · — |
| MoreMenu | 104.0 kB (−73 B) · 18.0 kB CSS (+22 B) | — | — · — · — |
| Selector | 109.3 kB (−81 B) · 17.9 kB CSS (+21 B) | — | — · — · — |
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.51 MB packed (+2.7 kB); 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
…lows a spring A CSS part that must follow a spring frame by frame takes the spring's progress as linear() easing. FR4a now names the module that samples it and why no existing module covers it.
|
/approve-spec a6cb1aa |
There was a problem hiding this comment.
Changes requested: the flick's close now writes the right easing, but the closing style's linear timing replaces it on every close, so the dim still lingers after the sheet is gone.
scrimClosingsets the backdrop'stransitionTimingFunctiontolinearafterstyles.scrimin the samestylex.propscall (BottomSheet.tsx:219-223, applied at:960, and at:1300for a switcher flow), so--_sheet-scrim-easingis never read while a sheet closes; let that rule readvar(--_sheet-scrim-easing, linear)instead.- The changeset says the dim now clears in step with the sheet and the description says main kept the standard ease, but this head plays the same fade as main, whose close fade is the closing style's
linearcurve; fix the code so the changeset holds, and correct the root-cause wording. onScrimFadeRefis still copied into a ref by a per-site layout Effect (BottomSheetPanel.tsx:800,:817); useuseCommittedRef(onScrimFade)and drop it from that Effect and its dependencies.linearEasing.tsrepeatsanimatedLayout.ts'sSAMPLES_PER_SECONDandsampleCount(:122,:250-252), whichanimatedLayoutstill uses for its keyframes; export onesampleCountfromlinearEasing.tsand use it in both.- The amended FR4a is verified by browser tests, but the new test only reads the inline variable in jsdom; assert the backdrop transition's easing in the Chromium release spec that already finds this fade.
The FR4a amendment is approved for this head, so no spec decision is pending. Mouse and pen drags, reduced motion and the other closes keep their current fade.
Claims and files checked
- Claim, changeset: a touch flick's close now clears the dim in step with the sheet. False: the closing style overrides the new easing (
BottomSheet.tsx:219-223,:960). - Claim, changeset: before, the sheet was gone in about a tenth of a second while the dim kept fading for over half a second. Consistent with the code: a linear fade over a settle of about 0.65 s.
- Claim, changeset: the fade now follows the close spring's progress. False, for the same reason.
- Claim, changeset: reduced motion and every other close are unchanged. Verified: the easing is written only for a played touch drag exit (
BottomSheetPanel.tsx:983-1002). - Claim, description: main's fade kept the stylesheet's standard ease. False: closes use the closing style's
lineartiming, which the measured 15–20 % at 0.13 s matches. - Claim, description: the close spring covers most of its distance at once and its settle time has a long sub-pixel tail. Verified: about 83–87 % of the travel at 0.13 s of a settle of about 0.66 s.
- Claim, description: the panel hands the host the close's duration and progress easing. Verified (
BottomSheetPanel.tsx:151-158,:998). - Claim, description: the host writes the easing beside the duration and clears both when the close ends. Verified for the write (
BottomSheet.tsx:341-342); the easing is cleared only while the written duration is still inline (:330-333). - Claim, description: the scrim's timing reads the variable and otherwise keeps the standard ease. Partly: the open-state rule reads it (
:199), but the closing rule replaces it (:221). - Claim, description:
resolveMoveTiminggives the duration asresolveSettleMsdoes. Verified (resolveMotion.ts:174-183,:192-206;resolveMotion.tempo.test.ts:255). - Claim, description:
linearEasingis shared and the glide output is unchanged. Verified: the stop count and rounding are the same. - Claim, description: the new test fails on main. Consistent with the code: main writes no easing. Not run.
- Claim, description: the BottomSheet and motion suites pass. Not reproduced.
- Claim, description: a phone comparison after the change follows. Still to come.
- Claim, description: no new public API, and no internal context in public text. Verified.
- File
.changeset/bottom-sheet-scrim-follows-flick.md: claim not met (finding 2). - File
docs/specs/AST-108-theme-motion/spec.md: clear; the amendment is approved for this head. - File
packages/core/src/BottomSheet/BottomSheet.tsx: finding 1. - File
packages/core/src/BottomSheet/BottomSheetPanel.tsx: finding 3, plus a doc-comment suggestion. - File
packages/core/src/BottomSheet/BottomSheetDragExit.test.tsx: evidence gap (finding 5). - File
packages/core/src/motion/linearEasing.ts: finding 4. - File
packages/core/src/motion/animatedLayout.ts: finding 4. - File
packages/core/src/motion/resolveMotion.ts: clear. - File
packages/core/src/motion/resolveMotion.tempo.test.ts: clear. - File
packages/core/src/motion/README.md: clear.
| /** | ||
| * How long a drag's close plays, in ms. It is the close spring's move from | ||
| * where the finger left the sheet, timed as the shared animator times it. | ||
| * How a drag's close plays: the close spring's move from where the finger |
There was a problem hiding this comment.
Non-blocking (INV29 style): this is one 26-word sentence with three topics. Suggested rewrite: "The scrim fade for a drag's close: the close spring's move from where the finger left the sheet."
While a sheet closes, scrimClosing gives the backdrop a linear timing function, and it comes after the scrim style. So it overrode the close spring's easing that the touch flick writes, and on an iPhone and a Pixel the scrim still faded linearly over the spring's whole settle time: 10-17 % faded when the sheet was gone. scrimClosing now reads var(--_sheet-scrim-easing, linear): every close stays linear except a touch flick, which follows the spring. Tests: BottomSheetScrimFlick.a11y.chromium.spec.ts flicks the Showcase sheet and reads the backdrop's computed opacity each frame. Once the sheet has slid 95 % out, the opacity must be under a quarter of its rest value. On main it is about 0.8 of rest. The release-only scrim clock spec now reads its watch only once the close has started, and flicks once more when the harness delivers the first flick too slowly under load.
|
/approve-spec 9b3e9a8 |
There was a problem hiding this comment.
Changes requested: a touch flick's close now fades the dim along the close spring, so it clears about half a second sooner than before, but about a third of it still shows as the sheet leaves the screen, and two CI checks fail.
- Miss: the scrim's easing follows the close spring over the sheet's whole height, including the reserve kept below the viewport (
useSheetGestures.ts:1244,BottomSheetPanel.tsx:151-157), so about 0.31 of the dim remains once the sheet is 95 % off screen and the newBottomSheetScrimFlickspec fails against its 0.25 bar; hand the panel the on-screen distance (visibleHeightForOffset) and let the easing reach 1 once the spring has covered it. - Miss:
--_sheet-scrim-easingfailsderivedVarRegistry.test.ts:486, so add it toSTRUCTURAL_VARSbeside--_sheet-scrim-opacityand--_sheet-scrim-duration. - The changeset's "clears in step with the sheet" and the description's per-frame, passing-spec and clock-spec claims do not hold at this head, so fix the defects or narrow the wording to what ships.
onScrimFadeRefis still copied in a per-site layout Effect (BottomSheetPanel.tsx:813-818), so create it withuseCommittedRef(onScrimFade)instead.linearEasing.tsrepeatsanimatedLayout.ts'sSAMPLES_PER_SECONDandsampleCount, so export onesampleCountand call it from both modules.- The clock spec's retry takes the settle-back transition after a too-slow flick for the close, so its second flick never runs (
BottomSheetScrimClock.a11y.browser.spec.ts:119-127); count only the animator's close or wait for the dialog to close.
The FR4a amendment is approved for this revision and no public API changes. One comment on dragExitFade could be shorter (non-blocking).
Claims and files checked
- Claim: a flick's dim now clears together with the sheet — false: 0.30–0.32 of the dim remains on the frame the sheet leaves the screen (Chromium), and CI's frame spec measures 0.31.
- Claim: before the change the dim lingered for over half a second after the sheet — consistent: in Chromium the dim on the base keeps fading for about 0.6 s after the sheet leaves.
- Claim: the fade keeps its duration and takes the spring's progress as
linear()easing — verified (resolveMotion.ts:192-206,resolveMotion.tempo.test.ts:235-268). - Claim: the scrim's opacity follows the sheet's position on every frame — false: it follows the spring's travel, the off-screen reserve included.
- Claim: the panel hands the host the close's duration and easing — verified (
BottomSheetPanel.tsx:151-157,:998). - Claim: the host writes the easing beside the duration, clears both when the close ends, and every other close stays
linear— verified (BottomSheet.tsx:218-222,:316-342). - Claim: one sampler serves
animatedLayout's glides with unchanged output — output unchanged verified; the sample count is still duplicated (finding above). - Claim: reduced motion, the stack's 0 s hand-over and a mouse drag's close keep their fade — verified (
BottomSheetPanel.tsx:983-989,BottomSheet.tsx:335-338,useSheetGestures.ts:1242-1246). - Claim: the Chromium frame spec and two jsdom tests fail on main and pass here — false for the Chromium spec, which fails at this head; the jsdom tests pass.
- Claim: the clock spec reads its watch only once the close has started — false after a settle-back (finding above).
- Claim: the BottomSheet and motion suites pass and no public API changes — verified; the theming registry test outside those suites fails.
- Changeset: the fade follows the close spring's progress and other closes are unchanged — verified; "clears in step with the sheet" — false.
.changeset/bottom-sheet-scrim-follows-flick.md— claim finding.docs/specs/AST-108-theme-motion/spec.md— clear (owner-approved).packages/core/src/BottomSheet/BottomSheet.tsx— registry-test finding.packages/core/src/BottomSheet/BottomSheetDragExit.test.tsx— clear.packages/core/src/BottomSheet/BottomSheetPanel.tsx— reserve and ref findings; one non-blocking comment note.packages/core/src/BottomSheet/__tests__/BottomSheetScrimClock.a11y.browser.spec.ts— retry finding.packages/core/src/BottomSheet/__tests__/BottomSheetScrimFlick.a11y.chromium.spec.ts— clear; it correctly fails on the reserve finding.packages/core/src/motion/README.md— clear.packages/core/src/motion/animatedLayout.ts— sampler finding.packages/core/src/motion/linearEasing.ts— sampler finding.packages/core/src/motion/resolveMotion.tempo.test.ts— clear.packages/core/src/motion/resolveMotion.ts— clear.
On a touch screen the sheet's surface reaches below the screen by its reserve (40 % of the viewport), so a pull past the top never shows the page. The close spring runs to the fully closed position, reserve included, and the scrim's easing tracked its progress over that whole distance. On a 390x844 phone the sheet leaves view at about 55-60 % of that distance, so on an iPhone and a Pixel 38-46 % of the dim was still there when the sheet was gone. The scrim's progress is now measured toward the point where the sheet leaves view: the viewport's bottom less the sheet's top at release, capped at the close's distance. It reaches 1 there and stays at 1. The fade still lasts the spring's settle time. resolveMoveTiming takes this point as an optional doneAt. Tests: with 140 px of the sheet on screen, the scrim's easing equals the share of that exit the sheet has made and holds at 1 after it; doneAt holds the easing at 1 from the move's first arrival. Both fail before this change. The Chromium frame spec (dim under a quarter of rest once the sheet is 95 % out of view) fails on main at 0.75 of rest.
BottomSheetPanel.tsx: keeps main's useCommittedRef callback refs, entrance.isReactivated and its reportFade helper, and carries this branch's onScrimFade and dragExitFade through them.
|
/approve-spec 56a3553 |
There was a problem hiding this comment.
Changes requested: a touch flick's dim now clears as the sheet leaves the screen, and the new frame spec passes, but four points block approval.
- Miss:
--_sheet-scrim-easingfailsderivedVarRegistry.test.ts:486("undocumented CSS vars"), so add it toSTRUCTURAL_VARSbeside--_sheet-scrim-opacityand--_sheet-scrim-duration. linearEasing.tsrepeatsanimatedLayout.ts'sSAMPLES_PER_SECONDandsampleCount, so export onesampleCountand call it from both modules.- The clock spec's retry takes the settle-back after a too-slow flick for the close, so its second flick never runs (
BottomSheetScrimClock.a11y.browser.spec.ts:77-82,:119-127); count only the animator's close or wait for the dialog to close. - Miss: the description has no
## Writing rubric resultssection, which a pull request that changes a record (herespec:AST-108FR4a) must carry; add one line per rubric item.
The FR4a amendment is approved for this revision and no public API changes. Two non-blocking points: on the frame after release the dim dips before the sheet starts to move, and dragExitFade could take the on-screen distance from the gesture instead of reading layout.
Claims and files checked
- Changeset: a flick's dim now clears in step with the sheet — verified: in Chromium the dim is at 0 of rest on the first frame the sheet is off screen, against 0.71 before.
- Changeset: before, the sheet was gone in about a tenth of a second while the dim kept fading for over half a second — consistent: about 0.09 s from release to off screen, and the dim fades until about 0.8 s.
- Changeset: the fade follows the close spring's progress, and reduced motion and every other close are unchanged — verified (
resolveMotion.ts:197-222,BottomSheetPanel.tsx:1001-1007; mouse, pen and reduced-motion closes write no easing). - Description: on phones the dim lingered 0.5–0.7 s after the sheet was gone — a stated device result for main, consistent with Chromium.
- Description: the linear fade over the whole settle time is the cause — verified (
BottomSheet.tsx:219-223on the base; the settle is about 0.71 s). - Description: the reserve is 40 % of the viewport, so the sheet leaves view at about 55–60 % of the close — consistent (523 of 861 px, 61 %, in the Showcase).
- Description: the fade keeps its duration and measures progress toward where the sheet leaves view — verified (
BottomSheetPanel.tsx:156-173, the new jsdom tests). - Description: the host writes the easing beside the duration, clears both when the close ends, and other closes stay
linear— verified (BottomSheet.tsx:317-343,:219-223). - Description:
resolveMoveTiminggives the duration asresolveSettleMsdoes and matches the animator's curve attempo1.5 — verified (resolveMotion.tempo.test.ts). - Description: one sampler serves the glides with unchanged output — output unchanged verified; the sample count is still duplicated (finding above).
- Description: reduced motion, the stack's 0 s hand-over and a mouse drag's close keep their fade — verified (
BottomSheetPanel.tsx:1001-1007,BottomSheet.tsx:336-339,useSheetGestures.ts:1216-1255). - Description: the frame spec requires under a quarter of rest once the sheet is 95 % out, where main reads about 0.8 — it passes twice here; main reads 0.73 at 94 % out in this review's capture.
- Description: the new jsdom easing test checks the easing at six points of the close — verified.
- Description: the existing drag-exit tests pass unchanged — verified.
- Description: the new tests fail on main — the jsdom tests need code main lacks; the frame spec's bar is consistent with main's 0.73.
- Description: the clock spec reads its watch only once the close has started — false after a too-slow flick (finding above).
- Description: the BottomSheet and motion suites pass — verified (52 files); the theming-registry test outside them fails (finding above).
- Description: no new public API — verified (the API generator lists no change).
- Description: public text holds no internal context — verified.
.changeset/bottom-sheet-scrim-follows-flick.md— clear.docs/specs/AST-108-theme-motion/spec.md— approved for this revision; rubric results missing (finding above).packages/core/src/BottomSheet/BottomSheet.tsx— registry finding (the new variable).packages/core/src/BottomSheet/BottomSheetDragExit.test.tsx— clear.packages/core/src/BottomSheet/BottomSheetPanel.tsx— registry finding (the reset at:397); two non-blocking notes.packages/core/src/BottomSheet/__tests__/BottomSheetScrimClock.a11y.browser.spec.ts— retry finding.packages/core/src/BottomSheet/__tests__/BottomSheetScrimFlick.a11y.chromium.spec.ts— clear.packages/core/src/motion/README.md— clear.packages/core/src/motion/animatedLayout.ts— sampler finding.packages/core/src/motion/linearEasing.ts— sampler finding.packages/core/src/motion/resolveMotion.tempo.test.ts— clear.packages/core/src/motion/resolveMotion.ts— clear; one non-blocking comment note.
| const viewportHeight = element.ownerDocument.defaultView?.innerHeight ?? 0; | ||
| const shown = Math.max( | ||
| 0, | ||
| viewportHeight - element.getBoundingClientRect().top, |
There was a problem hiding this comment.
Non-blocking (architecture:react-component-runtime INV18): this adds a layout read to the close's commit. The gesture already holds the sheet's height, its offset and the reserve at the release (useSheetGestures.ts:1242-1245), and visibleHeightForOffset(height, offset, reserve) (:351-357) gives the on-screen part. Carrying that on SheetDragExit would let dragExitFade read no layout.
The theme registry test lists every private CSS variable a component writes; --_sheet-scrim-easing joins --_sheet-scrim-opacity and --_sheet-scrim-duration. motion/linearEasing exports sampleCount, and animatedLayout calls it instead of keeping its own copy. The scrim clock spec now flicks again only when no fade has started, since a flick that settles back starts a sheet motion but no fade.
|
/approve-spec 4e01414 |
There was a problem hiding this comment.
Approved. A touch flick's dim now clears as the sheet leaves the screen: in Chromium the first frame with the sheet off screen keeps 0–4 % of the dim here against 73 % before, the new frame spec passes, and CI is green on this revision.
Non-blocking suggestions:
- On the release frame the dim drops to 56–71 % and then rises by 6–12 % on the next frame before it follows the sheet, because the fade starts one frame before the close and is then moved onto the close's start (
BottomSheetPanel.tsx:1066-1080); starting the fade on the close's first frame would remove that flicker. dragExitFadecould take the on-screen distance from the gesture (visibleHeightForOffset) instead of reading layout when the close starts (BottomSheetPanel.tsx:157-161), and its comment (:149-155) and the comment atresolveMotion.ts:210can be shorter.
Claims and files checked
- Changeset: a touch flick's dim now clears in step with the sheet — verified: 0–4 % of the dim on the first off-screen frame here against 73 % before, and the new frame spec passes.
- Changeset: before, the sheet was gone in about a tenth of a second with the dim mostly there, and it kept fading over half a second more — consistent: the sheet leaves the screen about 80 ms after its close starts with 73 % of the dim left, and the dialog closes about 0.63 s later.
- Changeset: the fade follows the close spring's own progress — verified (
resolveMotion.ts:197-222,BottomSheetPanel.tsx:156-173). - Changeset: reduced motion and every other close are unchanged — verified (
BottomSheetPanel.tsx:1001-1007,BottomSheet.tsx:219-222; only a touch release passes a drag exit,useSheetGestures.ts:1243-1255). - Description: on two phones the sheet was gone in about 0.13 s with 15–20 % of the dim cleared, and the dim stayed 0.5–0.7 s more — stated device results, consistent with Chromium.
- Description: the cause is a linear fade over the spring's whole settle time — verified (the base's closing style is
linear; the settle is about 0.69 s). - Description: the surface reaches 40 % of the viewport below the screen, so the sheet leaves view at about 55–60 % of the close — consistent (a 338 of 844 px reserve; the sheet leaves view at about 61 %).
- Description: the fade keeps its duration and measures progress toward where the sheet leaves view — verified (
BottomSheetPanel.tsx:156-173,BottomSheetDragExit.test.tsx:395-425). - Description: the host writes the easing beside the duration, clears both when the close ends, and other closes stay
linear— verified (BottomSheet.tsx:317-343,:219-222). - Description:
resolveMoveTiminggives the duration asresolveSettleMsdoes and its progress aslinear()easing, checked against the animator's curve attempo1.5 — verified (resolveMotion.tempo.test.ts:235-305). - Description: one sampler now serves the release glides with unchanged output — verified (same formula and rounding;
sampleCountis shared,animatedLayout.ts:85). - Description: reduced motion, the stack's 0 s hand-over and a mouse drag's close keep their fade — verified (
BottomSheetPanel.tsx:1001-1007,BottomSheet.tsx:337-339, the mouse-drag test). - Description: the frame spec needs under a quarter of rest once the sheet is 95 % out, where main reads about 0.8 — consistent: it passes here, and the base reads 0.73–0.75 at that point.
- Description: the jsdom easing test checks six points of the close — verified (
BottomSheetDragExit.test.tsx:363-393). - Description: the existing drag-exit tests and the glide easing are unchanged — verified.
- Description: the new tests fail on main and pass here — verified for the jsdom tests (three fail on the base); the frame spec's limit fails on the base's measured frames.
- Description: the clock spec reads its watch only once the close has started — verified (
BottomSheetScrimClock.a11y.browser.spec.ts:108-134). - Description: the BottomSheet and motion suites pass (52 files, 1,636 tests) — verified as passing; this revision has 1,650 tests in those files.
- Description: the typecheck passes — verified.
- Description: Pixel 8 results at this revision and at the earlier one, and an iPhone run that could not resolve the fade — stated device results, consistent with Chromium.
- Description: no new public API and no internal context in public text — verified (the API report lists no change).
- Description: writing rubric results for the record change — present, and they match the added sentences.
.changeset/bottom-sheet-scrim-follows-flick.md— clear.docs/specs/AST-108-theme-motion/spec.md— clear; the amendment is approved for this revision.packages/core/src/BottomSheet/BottomSheet.tsx— clear.packages/core/src/BottomSheet/BottomSheetDragExit.test.tsx— clear.packages/core/src/BottomSheet/BottomSheetPanel.tsx— non-blocking notes (release-frame dip, layout read, comment).packages/core/src/BottomSheet/__tests__/BottomSheetScrimClock.a11y.browser.spec.ts— clear.packages/core/src/BottomSheet/__tests__/BottomSheetScrimFlick.a11y.chromium.spec.ts— clear.packages/core/src/motion/README.md— clear.packages/core/src/motion/animatedLayout.ts— clear.packages/core/src/motion/linearEasing.ts— clear.packages/core/src/motion/resolveMotion.tempo.test.ts— clear.packages/core/src/motion/resolveMotion.ts— non-blocking comment note.packages/core/src/theme/derivedVarRegistry.test.ts— clear.
|
/approve-spec 0f5b953 |
There was a problem hiding this comment.
Approved pending CI: CI is still running on this revision, and the pull request merges only once its required checks pass.
A touch flick's dim now clears as the sheet leaves the screen: in Chromium the first frame with the sheet off screen keeps about 2 % of the dim here against 73 % before, and the new frame spec passes here and fails without the change.
Non-blocking suggestions:
- On the release frame the dim drops to about 67 % and rises to 71 % on the next frame before it follows the sheet, because the fade starts one frame before the close and is then moved onto the close's start (
BottomSheetPanel.tsx:1063-1080). dragExitFadecould take the on-screen distance from the gesture instead of reading layout when the close starts (BottomSheetPanel.tsx:157-161), and its comment (:149-155) and the comment atresolveMotion.ts:210can be shorter.
Claims and files checked
- Changeset: a touch flick's dim now clears in step with the sheet — verified: about 2 % of the dim on the first off-screen frame here against 73 % before, and the new frame spec passes here and fails on the base.
- Changeset: before, the sheet was gone in about a tenth of a second with the dim mostly there, and it kept fading over half a second more — consistent: the sheet leaves the screen about 80 ms after the release with 73 % of the dim left, and the dialog closes about 0.65 s later.
- Changeset: the fade follows the close spring's own progress — verified (
resolveMotion.ts:197-222,BottomSheetPanel.tsx:156-173). - Changeset: reduced motion and every other close are unchanged — verified (
BottomSheetPanel.tsx:1001-1007,BottomSheet.tsx:221; only a touch release passes a drag exit,useSheetGestures.ts:1217-1255). - Description: on two phones the sheet was gone in about 0.13 s with 15–20 % of the dim cleared, and the dim stayed 0.5–0.7 s more — stated device results, in line with Chromium.
- Description: the cause is a linear fade over the spring's whole settle time — verified (the base's closing style is
linear; the settle is about 0.70 s). - Description: the surface reaches 40 % of the viewport below the screen, so the sheet leaves view at about 55–60 % of the close distance — consistent (523 px of an 861 px sheet on screen at rest; after the 100 px drag it leaves view at about 56 % of the close distance).
- Description: the fade keeps its duration and measures progress toward where the sheet leaves view — verified (
BottomSheetPanel.tsx:156-173,BottomSheetDragExit.test.tsx:395-425). - Description: the panel hands the host the duration and the easing — verified (
BottomSheetPanel.tsx:1017-1023). - Description: the host writes the easing beside the duration, clears both when the close ends, and other closes stay
linear— verified (BottomSheet.tsx:290-321,:219-223). - Description:
resolveMoveTiminggives the duration asresolveSettleMsdoes and the progress aslinear()easing, checked against the animator's curve attempo1.5 — verified (resolveMotion.tempo.test.ts:235-305). - Description: one sampler now serves the release glides with unchanged output — verified (same formula and rounding;
sampleCountis shared,animatedLayout.ts:85). - Description: reduced motion, the stack's 0 s hand-over and a mouse drag's close keep their fade — verified (
BottomSheetPanel.tsx:1001-1007,BottomSheet.tsx:314-317, the mouse-drag test). - Description: the frame spec needs under a quarter of rest once the sheet is 95 % out, where main reads about 0.8 — verified: it passes here and reads 0.75 on the base.
- Description: the jsdom easing test checks six points of the close — verified (
BottomSheetDragExit.test.tsx:363-393). - Description: the existing drag-exit tests and the glide easing are unchanged — verified.
- Description: the new tests fail on main and pass here — verified (the frame spec and three jsdom tests fail on the base).
- Description: the clock spec reads its watch only once the close has started — verified (
BottomSheetScrimClock.a11y.browser.spec.ts:108-134). - Description: the BottomSheet and motion suites pass — verified (53 files and 1,803 tests with the theming registry).
- Description: the typecheck passes — verified.
- Description: Pixel 8 results at this revision and two earlier ones, and an iPhone run that could not resolve the fade — stated device results, in line with Chromium at this revision.
- Description: no new public API and no internal context in public text — verified (the API generator lists no change).
- Description: writing rubric results for the record change — present, and they match the added sentences.
.changeset/bottom-sheet-scrim-follows-flick.md— clear.docs/specs/AST-108-theme-motion/spec.md— clear; the amendment is approved for this revision.packages/core/src/BottomSheet/BottomSheet.tsx— clear.packages/core/src/BottomSheet/BottomSheetDragExit.test.tsx— clear.packages/core/src/BottomSheet/BottomSheetPanel.tsx— non-blocking notes (release-frame dip, layout read, comment).packages/core/src/BottomSheet/__tests__/BottomSheetScrimClock.a11y.browser.spec.ts— clear.packages/core/src/BottomSheet/__tests__/BottomSheetScrimFlick.a11y.chromium.spec.ts— clear.packages/core/src/motion/README.md— clear.packages/core/src/motion/animatedLayout.ts— clear.packages/core/src/motion/linearEasing.ts— clear.packages/core/src/motion/resolveMotion.tempo.test.ts— clear.packages/core/src/motion/resolveMotion.ts— non-blocking comment note.packages/core/src/theme/derivedVarRegistry.test.ts— clear.






User impact
When someone closes a BottomSheet with a quick downward flick on a phone, the dim behind the sheet now clears together with the sheet. Before, on an iPhone and on a Pixel, the sheet was gone in about 0.13 s while the dim had cleared only 15–20 %, and a dim veil stayed over the page for another 0.5–0.7 s.
Problem and solution fit
linear()). Its progress is measured toward the point where the sheet leaves view, so the dim is clear as the sheet goes; the fade's duration stays the spring's settle time.Expected behavior and authority
spec:AST-108FR4a: "Animations that run together start and land together … This covers … a sheet and its scrim … and BottomSheet's scrim, whose fade lasts the sheet's computed settle time." The duration is unchanged; the easing now makes the two land together.Smallest restoration
BottomSheetPanel: for a touch drag's close, the panel hands the host the close's duration and its progress easing (resolveMoveTiming) instead of the duration alone.BottomSheet: the host writes--_sheet-scrim-easingbeside--_sheet-scrim-durationon the dialog, and clears both when the close ends. The closing scrim style (scrimClosing) reads it as itstransition-timing-function, and stayslinearfor every other close.motion/resolveMotion:resolveMoveTiminggives a move's duration, asresolveSettleMsdoes, and its progress aslinear()easing.motion/linearEasing: one sampler forlinear()easing text, whichanimatedLayout's release glides now share. Their output is unchanged.Evidence
Reproduction before the change: vjeux's iPhone 14 and Pixel 8 farm, main's BottomSheet Showcase, a ~60 px fast flick from the grabber. The scrim's fade starts with the slide, but the sheet is gone in ~0.13 s with the scrim 15–20 % faded, and the scrim finishes ~0.5–0.7 s later on both phones.
Result after the change:
BottomSheetScrimFlick.a11y.chromium.spec.tsflicks the Showcase sheet and reads the backdrop's computed opacity on every frame. Once the sheet has slid 95 % out, the opacity must be under a quarter of its rest value. On main it is about 0.8 of rest. In jsdom, "fades the scrim along the close spring when a drag closes the sheet" checks that the written easing equals the share of the distance the close spring has covered, at 0, 5, 10, 25, 50 and 100 % of the close.Representative unchanged path: the existing drag-exit tests for the fade's duration, its timing before the scrim clears, a switcher flow, a reopen during the exit, a mouse drag and reduced motion all pass unchanged.
animatedLayout's glide easing is unchanged.Regression tests: the Chromium frame spec and the two jsdom tests above fail on main and pass here. The release-only scrim clock spec now reads its watch only once the close has started.
resolveMoveTimingis checked against the animator's own curve for the same move attempo1.5. BottomSheet and motion suites pass (52 files, 1636 tests).Real phones at this head (Pixel 8, 0f5b953 against main b890479): the same flick, three takes per build. At the sheet's last visible frame, 5 %, 8 % and 0 % of the dim is left, and 0 % on the next frame in all three takes; main keeps about 83 %. With animations removed, both builds clear the scrim in 4–5 frames while the sheet fades in place. It matches the 4e01414 take below, so the merge of main's changes into this branch does not change the scrim.
Real phones at 4e01414 (Pixel 8, Chrome 157, against main): the same flick, three takes per build. At the last frame the sheet's heading is on screen, 4 %, 0 % and 4 % of the dim is left, and 0 % on the next frame in all three takes. Main keeps about 82 % when the sheet leaves, and both exits take about 135 ms. With animations removed, both builds clear the scrim in 4–6 frames while the sheet fades in place.
Real phones at 56a3553 (Pixel 8, Chrome 155): a 60 px flick in 48 ms on the grabber of the Showcase sheet, recorded at 60 fps, three takes per build, on this PR's preview at 56a3553 and on main. At the last frame the sheet is visible, at most 20 % of the dim is left (takes: 20 %, 17 %, 7 %), and 0–4 % once it is gone. On main about 80 % of the dim is still there when the sheet is gone, and it fades for about 0.6 s more. With animations removed, both builds clear the scrim within 2 frames and fade the sheet in place. An iPhone 14 run could not resolve the fade: its stream shows one frame between open and gone on both builds, so the Pixel is the evidence.
Scope
Components: BottomSheet, motion
Testing
pnpm vitest run --project ui packages/core/src/BottomSheet packages/core/src/motioncd packages/core && npx tsc --noEmit -p tsconfig.jsonBottomSheetScrimFlick.a11y.chromium.spec.tsin pr-a11y.Writing rubric results
Run over the one changed record passage,
spec:AST-108FR4a's added sentences on a CSS part that follows a spring frame by frame andmotion/linearEasing.