Repository navigation
fix(BottomSheet): a swipe that starts slowly on the sheet's content moves the sheet - #11140
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Requesting changes. Keeping both edges armed on content that fits fixes slow swipes in WebKit, and the new tests fail on main and pass here, but two things need fixing first:
- A sideways swipe along a row in a sheet whose content fits now starts the sheet's drag once it drifts 9 px down, because the promotion in
useSheetGestures.tschecks only vertical travel (in a Chromium touch run the sheet followed the drift 40 px on this branch and 0 px on main), whichspec:AST-094FR14 and FR20 rule out; please promote only a mostly vertical move, as the cancel already requires, and add a test for that swipe. - The changeset says the defect happened "on a touch screen", but your own Chromium runs closed the sheet 144 of 144 times before the change, so it should name WebKit browsers (Safari, and every browser on iPhone and iPad) instead.
Non-blocking: the list-at-top guard test drifts 3 px first, below the pan WebKit commits (spec:AST-094 DEC-29); a 6 px drift would pin the case FR14 settles.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| BottomSheet | 69.3 kB (+62 B) · 7.7 kB CSS (0) | — | ✗ · ✓ · — |
| BottomSheetSwitcher | 18.6 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| DateInput | 189.6 kB (+64 B) · 17.1 kB CSS (0) | — | — · — · — |
22 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 293.1 kB (+58 B) · 24.2 kB CSS (0) | — | — · — · — |
| DateTimeInput | 211.7 kB (+57 B) · 18.7 kB CSS (0) | — | — · — · — |
| TimeInput | 164.7 kB (+30 B) · 16.1 kB CSS (0) | — | — · — · — |
| Tokenizer | 94.8 kB (+1 B) · 18.8 kB CSS (0) | — | — · — · — |
| ContextMenu | 111.0 kB (0) · 17.5 kB CSS (0) | — | — · — · — |
| MoreMenu | 99.3 kB (0) · 17.6 kB CSS (0) | — | — · — · — |
| MultiSelector | 97.0 kB (0) · 16.9 kB CSS (0) | — | — · — · — |
| Pagination | 112.5 kB (0) · 17.8 kB CSS (0) | — | — · — · — |
| Popover | 93.0 kB (0) · 14.2 kB CSS (0) | — | — · — · — |
| Selector | 102.4 kB (0) · 17.4 kB CSS (0) | — | — · — · — |
| Table | 127.8 kB (0) · 18.4 kB CSS (0) | — | — · — · — |
| TableCell | 112.2 kB (0) · 17.9 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 111.8 kB (0) · 17.7 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 109.4 kB (0) · 1.1 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 154.4 kB (0) · 1.9 kB CSS (0) | — | — · — · — |
| lab/Comments | 355.5 kB (0) · 2.5 kB CSS (0) | — | — · — · — |
| lab/TourStep | 99.2 kB (0) · 590 B CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 281.3 kB (0) · 454 B CSS (0) | — | — · — · — |
| DropdownMenu | 99.1 kB (−1 B) · 17.6 kB CSS (0) | — | — · — · — |
| Markdown | 190.8 kB (−1 B) · 20.8 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 108.2 kB (−1 B) · 773 B CSS (0) | — | — · — · — |
| lab/CommentThread | 348.6 kB (−1 B) · 2.4 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.30 MB packed (+498 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 68 rows, core 36 rows; 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
c9b425f to
3ed97c9
Compare
There was a problem hiding this comment.
Requesting changes. The slow-start fix works: the new tests fail on main and pass here, and the sideways-drift and changeset points from the last round are fixed. One blocking issue remains:
- Because the mostly-vertical test is re-read on every move against travel since touch-down (
useSheetGestures.ts:1758-1775), a pull that begins more sideways than down reaches the sheet only when its vertical travel overtakes, and the sheet then jumps the whole travel (in Chromium a diagonal pull left the sheet still for 120 px and then moved it 130 px in one frame, where main follows from 10 px, and a chip-row swipe that turns into a pull jumped a fitting sheet 155 px after the browser had taken the touch), which goes againstspec:AST-094FR14 ("decided once, when the drag begins", no change of hands midway) and FR20; decide the axis once at the first move past the slop and stop tracking a sideways touch (or start the drag where the pull turned vertical and drop it on an uncancelable sideways move), and update the test atuseSheetGestures.test.ts:1818and the changeset's "A list that scrolls keeps its behavior" to match.
…oves the sheet In WebKit, a touch on a sheet whose content fits arms both scroll edges. A first move of 8 px or less disarmed both edges, so the pull never reached the sheet: the sheet stayed open, or jumped a few pixels and fell back. A fast swipe, or a swipe on the grab bar, still worked. An edge now goes back to the native scroll only when the content has room to scroll that way. Content that fits has nothing to scroll, so both edges stay armed until the pull passes the drag slop. At the edge of a list that scrolls, a move away from the edge takes the touch for the scroll only once it passes a tap's wobble, 5 px. A shorter move commits no native pan, so a pull down that follows a small wobble up still moves the sheet. The first move past the drag slop on either axis now decides the touch, once. A mostly vertical pull against an armed edge is the sheet's drag. A mostly sideways move is the row's for the rest of the touch. Any other move is the content's scroll. So a swipe along a row that drifts, or that turns into a pull, never moves the sheet late.
3ed97c9 to
ca30677
Compare
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
The slow-start fix restores the sheet's pull on content that fits: the new tests fail on main and pass here, and a pull that starts more sideways than down no longer jumps the sheet late, which resolves the last round's blocking point.
- Non-blocking: the description still says a pull that begins sideways starts the drag once its vertical travel is the larger one, and quotes the earlier test counts, while the head drops a touch whose first move past the 8 px slop is mostly sideways (
useSheetGestures.ts:1797-1801); please update it to match the changeset.






User impact
On an iPhone, a person swipes down on a bottom sheet to close it. When nothing under the finger can scroll and the finger starts slowly, so that its first move is 8 px or less, the sheet does not follow the swipe. It stays open, or it jumps 9 to 30 px and falls back while the finger keeps pulling. A fast swipe closes the sheet, and so does a swipe that starts on the grab bar, so the same gesture works only some of the time.
This is every step of the PowerSearch sheet flow (Filters, Add filter, the value step) and the Tokenizer sheet that a list value opens: all four are sheets whose content fits. It is also the fixed header of a sheet whose list scrolls. At the top of a list that scrolls, the same thing happens when the finger wobbles up a pixel or two as it lands. The defect is in WebKit, which gives the page every
touchmove. Chromium is not affected: it sends the page notouchmoveinside its own touch slop, so the first move a page sees is already past 8 px.Problem and solution fit
The fix has three parts, all in the body's
touchmovehand-off:spec:AST-094DEC-29), so nothing has changed hands before that. A pull down that follows a wobble up of 1 to 4 px still moves the sheet. A move up of 5 px or more scrolls the list, as before.How the 5 px pan cancel (#10033) and this fix meet, for a pull straight down on content that fits:
Expected behavior and authority
spec:AST-094FR14: "If the area sits at its edge and the drag moves toward that edge, the surrounding surface (a sheet) takes the drag", decided "once, when the drag begins", and "The drag MUST NOT change hands midway". Content that fits sits at both edges. A move under a tap's wobble is not yet a drag.spec:AST-094FR20: "The main axis is the one the finger has moved farther along since touch-down, horizontal on a tie". A move whose main axis is horizontal is not a drag toward the top or bottom edge, so FR14 does not give it to the sheet.spec:AST-094FR17 and FR19: a pan begins at its slop of travel on either axis, and a recognizer that competes with native scrolling decides within 10 px of travel.spec:AST-094FR19, DEC-18 and DEC-29: a sheet's pull cancels its touch's moves once the pull reaches a tap's wobble, while every scroller under the finger sits at its edge and the drag moves toward that edge. A kept move of 5 px commits Mobile Safari to the native pan, and a kept move of 4 px commits nothing.component:BottomSheetFR18: a pull on the sheet's body is the sheet's "once the content has no room left to scroll that way: content that fits stretches at once".component:PowerSearchFR13, FR15a and FR21: a swipe dismisses the top sheet of the flow.No record changes: the code now does what these clauses state.
Smallest restoration
The three conditions above, in one block of
useSheetGestures.ts. No API, no visual, no default and no timing changes.Behavior that changes on paths that worked on main, all from the once-only decision:
Not in this change:
spec:AST-094FR14's rule, and this change leaves it alone.Evidence
The page is Storybook's PowerSearch "Bottom sheet (forced)" story on a 402 x 714 phone viewport. Its four sheets are Tall sheets whose content fits. Every swipe is real touch input: WebKit's input command in Playwright WebKit, CDP touch in Chromium, and HID touches in the iOS Simulator (iOS 27.0, iPhone 17, Safari). A swipe starts on the grab bar, on the fixed header, or on a row of the content.
Which build each table measured: the first WebKit table and the Simulator table measured the first condition alone. The later conditions change no pull that travels straight down on content that fits. The WebKit re-run under that table, the Chromium counts, and the sideways table measured this head.
Playwright WebKit: a 400 px pull, then a lift. The count is the swipes that closed the sheet.
Slow start means a first move of 8 px or less: 3 px, 6 px, ten moves of 1 px, or 1 px up and then down. Fast start means a first move of 12 or 24 px. 144 swipes for each build.
By first move, header and content starts of all four sheets:
Before, 48 of the 64 failed swipes still moved the sheet 9 to 30 px before it fell back.
The same 144 swipes on this head, Playwright WebKit: 144/144 closed the sheet. That is 64/64 slow starts and 32/32 fast starts on the header and the content, and 48/48 on the grab bar.
iOS Simulator: a 120 px pull. The count is the swipes where the sheet was within 12 px of the finger at the lift.
48 swipes for each build, grouped by the first move the page saw.
Before, by first move: under 5 px 0/13, 5 to 8 px 0/18. After: 15/15 and 17/17. Before, each failed swipe moved the sheet 10 to 18 px, and the sheet was back at rest at the lift.
The grab bar in the Simulator on main, Filters and the value step, first moves of 4 to 6 px and of 30 px: 8/8 followed. The grab bar's path is not changed.
Chromium
Playwright Chromium, the same swipes: 144/144 closed the sheet on main, and 72/72 on this head. Chromium held back every
touchmoveinside its touch slop: the first move the page saw was 16 px or more in every swipe, the slow starts included.Sideways and diagonal moves
Playwright Chromium on Linux and Playwright WebKit on macOS, 3 runs for each cell in each engine. A finger starts on a row and moves as the first column says. The numbers are how far the sheet moved at most, and where it was at the lift, in px. The table shows Chromium; WebKit gave the same travel, and 1 to 3 px at the lift where Chromium gave 0 or 1.
The 9 and 20 px that remain are the short drag of the body's pointer path, which this change does not touch. With the edges kept armed but the axis read again on every move, the swipe that turns into a pull and the pull that begins sideways moved the sheet by the whole travel at once, 160 px and 169 px. The once-only decision removes that.
The production build
The same story on the production Storybook, in Playwright WebKit, 72 swipes: header and content starts closed the sheet on 0/32 slow starts and 16/16 fast starts, and the grab bar on 24/24. The published 0.7.13 sources of BottomSheet, PowerSearch and Tokenizer are the same as main's, so the defect is in the current release.
Representative unchanged paths
spec:AST-094DEC-29 records.Regression tests
useSheetGestures.test.ts, in "body touch handoff". 14 of these fail on main:Each condition was also removed in turn, and each removal fails at least one of these tests.
Scope
Components: BottomSheet
Testing
pnpm exec vitest run packages/core/src/BottomSheet/useSheetGestures.test.ts --project ui: 125 passed. With the source file at main: 14 failed, 111 passed.pnpm exec vitest run packages/core/src/BottomSheet packages/core/src/PowerSearch packages/core/src/Tokenizer packages/core/src/internal packages/core/src/hooks --project ui: 100 files, 2,475 tests passed.pnpm exec prettier --checkandpnpm exec eslinton the changed files,pnpm check:changesets.