Repository navigation
fix(BottomSheet): a slow swipe down on the sheet's content no longer rubber-bands the content under the finger on iOS - #10033
Conversation
…rubber-bands the content under the finger on iOS The body's touchmove handler cancelled the native pan only once a pull passed the 8 px promotion slop. Mobile Safari commits a touch to the scroller's pan on the first touchmove the page keeps once the finger has moved about 10 px, and no later preventDefault() stops a committed pan. A swipe whose first move was 4-7 px handed the content to the native scroll while the sheet's own drag began beside it: the content rubber-banded to about -134 px over a 320 px pull, under the moving sheet, and sprang back during the exit. A pull that opposes the armed scroll edge now cancels its touchmove as soon as it passes a tap's wobble (5 px), before the promotion. A real scroll is never cancelled, and a tap that wobbles up to 5 px keeps its click. AST-094 FR19 and DEC-18 record the take distance and the wobble allowance.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 0b4c2ae |
There was a problem hiding this comment.
Requesting changes. The BottomSheet fix itself holds up, and its new tests fail on main and pass here, but the spec amendment now forbids what Core's shared scroll-edge pan still does.
Blocking
- As amended here,
spec:AST-094FR19 and DEC-18 let a scroll-edge pan cancel moves only past a 5 px tap wobble, butPanGestureRecognizer.keepsTouch(packages/core/src/gestures/PanGestureRecognizer.ts) still cancels from the first move andGestureHost.test.tsasserts that a 2 px move is cancelled, so move the 5 px threshold into the shared gestures module, apply it inkeepsTouch, import it inuseSheetGestures.ts, and update that test and the gestures README.
Worth a look (non-blocking)
- The early cancel reads only vertical travel, so in a sheet at its top a sideways swipe on a horizontal row is cancelled once it drifts 6–8 px down, and cancelling only while vertical travel exceeds horizontal travel would keep FR19's "never a real scroll".
- FR19's new MUST sets the limit at the 10 px take distance although DEC-18 records that a kept 7 px first move already commits the pan, DEC-18's title still says "from the first move", and the changeset could say that a 5–8 px wobble toward the edge now loses the tap's click.
[Automated review]
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| BottomSheet | 68.3 kB (+73 B) · 7.7 kB CSS (0) | — | ✗ · ✓ · — |
| BottomSheetSwitcher | 17.9 kB (0) · 3.4 kB CSS (0) | — | ✗ · ✓ · — |
| TimeInput | 162.6 kB (+89 B) · 16.0 kB CSS (0) | — | — · — · — |
22 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput | 187.1 kB (+77 B) · 17.0 kB CSS (0) | — | — · — · — |
| PowerSearch | 288.4 kB (+67 B) · 24.2 kB CSS (0) | — | — · — · — |
| DateTimeInput | 208.8 kB (+52 B) · 18.7 kB CSS (0) | — | — · — · — |
| DropdownMenu | 97.3 kB (+1 B) · 17.6 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 106.1 kB (+1 B) · 773 B CSS (0) | — | — · — · — |
| lab/CommentComposer | 152.2 kB (+1 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/TourStep | 97.4 kB (+1 B) · 590 B CSS (0) | — | — · — · — |
| ContextMenu | 109.0 kB (0) · 17.4 kB CSS (0) | — | — · — · — |
| MoreMenu | 97.5 kB (0) · 17.6 kB CSS (0) | — | — · — · — |
| MultiSelector | 95.0 kB (0) · 16.8 kB CSS (0) | — | — · — · — |
| Pagination | 110.3 kB (0) · 17.8 kB CSS (0) | — | — · — · — |
| Popover | 91.1 kB (0) · 14.2 kB CSS (0) | — | — · — · — |
| Table | 125.6 kB (0) · 18.3 kB CSS (0) | — | — · — · — |
| TableCell | 110.2 kB (0) · 17.9 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 109.8 kB (0) · 17.7 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.5 kB (0) · 454 B CSS (0) | — | — · — · — |
| Markdown | 188.4 kB (−1 B) · 20.6 kB CSS (0) | — | — · — · — |
| Selector | 100.2 kB (−1 B) · 17.4 kB CSS (0) | — | — · — · — |
| lab/Comments | 352.1 kB (−1 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 345.2 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.23 MB packed (+739 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 36 rows; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
# Conflicts: # docs/specs/AST-094-touch-presentations/spec.md
…s follow the Specs ruling A pull past the tap's wobble is cancelled only while it moves more along the block axis than sideways, so a horizontal row's scroll in a sheet at its top stays a real scroll (FR19). A promoted drag still cancels its move. DEC-18 keeps its approved text; FR19 keeps 'from the first move' and adds the cause-stated bound, and DEC-29 records the Mobile Safari measurement and the 5 px wobble. The changeset names the 5 to 8 px wobble that now loses a tap's click.
|
/approve-spec 6bfdc56 |
A raw page that scrolls with the document opens a BottomSheet of 40 rows that scroll inside it, and reports the last row tapped, so a slow pull on the rows and a tap can be checked on a real device.
|
/approve-spec bac97c1 |
There was a problem hiding this comment.
Requesting changes. The early cancel itself holds up: both new cancel tests fail against main's handler and pass here, every BottomSheet suite passes, and the FR19 and DEC-29 amendment is owner-approved for this head.
Blocking
- The changeset (and the handler comment at
useSheetGestures.ts:1751-1752) says a mostly sideways swipe on a horizontal row is never cancelled, but the 8 px promotion atuseSheetGestures.ts:1768has no axis test, so a first move of 30 px sideways and 9 px down is still cancelled and becomes a sheet drag, as onmain: narrow the wording (for example "a mostly sideways swipe is not cancelled before the sheet's drag begins at 8 px") or give the promotion the same vertical-dominance test, with a 30/9 test case and its own phone check.
Worth a look (non-blocking)
- A diagonal first move that is at least as sideways as vertical is kept even over a list with no horizontal scroller (8 px sideways and 7 px down is kept), so by DEC-29's 7 px measurement it may still let Safari commit the pan; consider skipping the cancel only when an inline-axis scroller sits under the finger.
CI has not run on this head yet because the pull request is a draft.
[Automated review]
| if ( | ||
| (opposesTop || opposesBottom) && | ||
| Math.abs(delta) > PAN_CANCEL_SLOP && | ||
| Math.abs(delta) > Math.abs(t.clientX - armed.startX) && |
There was a problem hiding this comment.
Non-blocking: this exempts any move at least as sideways as vertical, even when no horizontal scroller sits under the finger (scrollChainUnder collects block scrollers only). A first move of 8 px sideways and 7 px down is kept, and DEC-29 records that a kept 7 px move commits the pan, so a diagonal start over a plain list may still bounce. Skipping the cancel only when an inline-axis scroller is under the finger would close that; a diagonal swipe on the simulator would show whether it matters.
…ag begins The early cancel skips a mostly sideways move, but the 8 px promotion keeps main's behavior and has no axis test. The changeset and the handler comment now say the exemption holds before the drag begins.
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head, and every check that has finished so far passes.
The early cancel holds up, and the changeset now limits the sideways exemption to before the sheet's drag begins at 8 px, which matches the code. Both new cancel tests fail against main's handler and pass here, every BottomSheet suite passes, and the FR19 and DEC-29 amendment is owner-approved for this head.
Worth a look (non-blocking)
- A first move at least as sideways as vertical is kept even over a list with no horizontal scroller (8 px sideways and 7 px down is kept), so by DEC-29's 7 px measurement a diagonal slow start may still let Safari commit the pan; skipping the cancel only when an inline-axis scroller sits under the finger would close it.
- Miss: the changeset's cause, "the first
touchmovea page keeps committed the touch", is broader than this pull request's own evidence, where kept first moves of 3–5 px do not commit; "a kepttouchmoveof about 7 px" matches DEC-29.
[Automated review]
| // edge. Its native pan is cancelled before the promotion slop, once the | ||
| // pull passes a tap's wobble, because a later cancel no longer stops a | ||
| // pan iOS Safari has committed. Before the sheet's drag begins, a mostly |
There was a problem hiding this comment.
Non-blocking (INV29 style): this sentence runs to 29 words and is passive. Suggested: "A pull toward the armed edge cannot scroll, because the chain is at that edge. Cancel its native pan once the pull passes a tap's wobble. iOS Safari commits the pan on a kept move, and a later cancel does not stop it."
|
/approve-spec 30437e1 |
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head, and no check has failed so far.
Starting the early cancel at 5 px rather than past it matches the iOS 26.2 measurement DEC-29 now records, and the new exact-wobble test fails against the previous revision and main and passes here. All 14 BottomSheet unit-test files pass, and the FR19 and DEC-29 amendment is owner-approved for this head.
Worth a look (non-blocking)
- A first move at least as sideways as vertical is still kept up to 8 px, even over a list with no horizontal scroller (5 px sideways and 5 px down is kept), so by DEC-29's 5 px measurement a slow diagonal start may still let Safari commit the pan; skipping the cancel only when an inline-axis scroller sits under the finger would close it.
- The changeset's "a first move past 8 px starts the drag in any direction" overstates, because a first move of 30 px sideways and 2 px down starts nothing; "once the pull toward the edge passes 8 px, the drag starts however sideways the move is" matches the code.
- DEC-29's "the author's earlier Mobile Safari 27.0 run" is project history in a record, where "Mobile Safari 27.0 on the simulator commits at 7 px" states the fact; the description's rubric results and Evidence section still describe the earlier DEC-29.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] BottomSheet: a finger's pull on the sheet's content at a scroll edge cancels the content's native pan as soon as the pull reaches a tap's wobble (5 px), before the sheet's own drag begins at 8 px. In iOS Safari the first `touchmove` a page keeps committed the touch to the content's scroll, so a slow-starting swipe down rubber-banded the content under the finger while the sheet moved beside it. A tap that wobbles less than 5 px keeps its click, while a tap that wobbles 5 to 8 px toward the edge now loses it. A real scroll is never cancelled. A mostly sideways swipe on a horizontal row is not cancelled before the sheet's drag begins; a first move past 8 px starts the drag in any direction, as before. |
There was a problem hiding this comment.
Non-blocking: "a first move past 8 px starts the drag in any direction, as before" reads as if any 8 px move starts the sheet's drag, but a first move of 30 px sideways and 2 px down, or 9 px up from the top, starts nothing: the promotion needs 8 px of pull toward the edge (useSheetGestures.ts:1770-1771). Suggested: "A mostly sideways swipe on a horizontal row is not cancelled before the sheet's drag begins; once the pull toward the edge passes 8 px, the drag starts however sideways the move is, as before." The handler comment at useSheetGestures.ts:1754 says the same.
| Mobile Safari commits a kept first move of 5 px to the native pan (iOS 26.2 | ||
| Simulator; a kept move of 4 px commits nothing; the author's earlier Mobile | ||
| Safari 27.0 run committed at 7 px), so BottomSheet cancels from a first move |
There was a problem hiding this comment.
Non-blocking: "the author's earlier Mobile Safari 27.0 run committed at 7 px" says who ran what, which the writing rubric (R1) keeps out of a record. Suggested: "(iOS 26.2 simulator; a kept move of 4 px commits nothing; Mobile Safari 27.0 on the simulator commits at 7 px)". The description's rubric results and Evidence section still describe the earlier 27.0-only DEC-29.
|
/approve-spec 2719e90 |
# Conflicts: # apps/sandbox/scripts/next-export-routes.json
There was a problem hiding this comment.
Approval waits on an engineering owner approving the spec:AST-094 record changes at this head. FR19's new sentence and DEC-29 are the text approved earlier, but the merge of main left no approval on this head. An engineering owner, the author included, records the decision by commenting /approve-spec <full head SHA> on this pull request. The BottomSheet change itself holds up: the new cancel tests fail against main's handler and pass here, and all 14 BottomSheet unit-test files pass.
Worth a look (non-blocking)
- The real-iPhone pass that the description lists as due at this head is still needed: the earlier simulator runs behind DEC-29's 5 px commit point do not carry across this merge, because it changed files this pull request changes.
- A first move at least as sideways as vertical is still kept up to 8 px, even over a list with no horizontal scroller (5 px sideways and 5 px down, for example), so a slow diagonal start may still let Safari commit the pan.
- The earlier wording notes are still open: the changeset's "the first
touchmovea page keeps" and "in any direction", DEC-29's "the author's earlier … run", and the handler comment's 29-word sentence.
[Automated review]
|
/approve-spec cd50f7f |
There was a problem hiding this comment.
Changes requested: one piece of required evidence is missing at this head. The spec:AST-094 record changes are approved for this head, and the BottomSheet change itself holds up: the new cancel tests fail against main's handler and pass here, and all 14 BottomSheet test files pass.
Blocking
- Regression: the merge of
mainchanged three files this pull request changes, so underspec:AST-094DEC-31 the earlier device runs no longer count, and the real-device evidence that AST-094's Platform support and DEC-27 require for its iOS Safari claims (the rubber-band fix and DEC-29's 5 px commit point) is missing; run the description's phone check on a real iPhone against this head and record the results in the description.
Worth a look (non-blocking)
- A first move at least as sideways as vertical (6 px by 6 px, say) is still kept up to 8 px over a list with no horizontal scroller, so a slow diagonal start may still let Safari commit the pan; the real-device pass can include one.
- The earlier wording notes are still open: the changeset's "the first
touchmovea page keeps" and "in any direction", DEC-29's "the author's earlier … run", and the handler comment's 29-word sentence.
CI has not run on this head yet because the pull request is a draft.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head, and no check has failed so far.
The early cancel holds up: the new cancel tests fail against main's handler and pass here, all 14 BottomSheet test files pass, the spec:AST-094 FR19 sentence and DEC-29 are approved for this head, and the real-iPhone pass recorded in the description covers the iOS Safari claims.
Worth a look (non-blocking)
- A first move at least as sideways as vertical (6 px by 6 px, say) over a list with no horizontal scroller is still kept until 8 px, which the description already lists as a follow-up.
- The changeset's "the first
touchmovea page keeps" and "in any direction", the handler comment's 29-word sentence, and DEC-29's "the author's earlier … run" still read broader or more historical than the code and the record need.
[Automated review]
|
/approve-spec 4ad6d46 |
There was a problem hiding this comment.
Approved. CI has run on this head and passes.
The early cancel holds up: the new cancel tests fail against main's handler and pass here, the spec:AST-094 FR19 sentence and DEC-29 are approved for this head, and the real-iPhone check recorded in the description still applies, because the latest merge of main touched none of this change's files or imports.
Worth a look (non-blocking)
- A first move at least as sideways as vertical (6 px by 6 px, say) over a list with no horizontal scroller is still kept until 8 px, which the description already lists as a follow-up.
- The changeset's "the first
touchmovea page keeps" and "in any direction", the handler comment's 29-word sentence, and DEC-29's "the author's earlier … run" still read broader or more historical than the code and the record need.
[Automated review]
|
(Posted by Cindy's agent.) Merged. Thank you, @imdreamrunner! On iOS, a slow pull on a BottomSheet no longer makes its content rubber-band. Our team added a few follow-up commits on your branch, checked it on a real iPhone, and kept your authorship. |






User impact
A finger that swipes a BottomSheet down from its content, on iOS Safari, sometimes sees two things move: the sheet follows the finger, and the content inside the sheet rubber-bands under it at the same time (to about −134 px over a 320 px pull), then springs back during the exit. It happens when the swipe starts slowly: when the finger's first
touchmovereaches the page before it has travelled 8 px. A swipe whose first move is 8 px or more is smooth. The sheet's grabber is never affected, only its scrolling content.Problem and solution fit
Why does the content move: the sheet's body handler cancels the native pan (
preventDefault()ontouchmove) only once the pull passesDRAG_PROMOTION_SLOP(8 px). Mobile Safari commits a touch to the scroller's pan on the firsttouchmovethe page keeps once the finger has moved about 10 px (spec:AST-094FR2's scroll take distance), and no laterpreventDefault()stops a committed pan. So a first move of 4–7 px that the page keeps, followed by a move past 10 px, hands the body to the native scroll (pointercancelfires) while the sheet's own drag starts beside it.Why does it harm the task: the content bounces against the finger while the sheet moves, so the swipe reads as janky and the dismissal as unsure.
Why does it matter: dismissing a sheet by swiping its content is the most common way to close it on a phone.
The fix cancels the native pan as soon as the pull opposes the armed edge by more than a tap's wobble (
PAN_CANCEL_SLOP, 5 px), before the drag's own 8 px promotion, so no move the browser could commit on is ever kept. A real scroll (a pull away from the edge) is never cancelled.Expected behavior and authority
spec:AST-094FR14 (a drag that starts at a scroll edge toward that edge is the sheet's, decided once) and FR19 with DEC-18 (a scroll-edge pan may cancel its touch's moves before the pan begins, only while every scroller sits at its edge and the drag moves toward it). This change implements DEC-18. Per the specs owner's ruling, DEC-18 keeps its approved text; FR19 keeps "MAY cancel … from the first move" and adds: "A scroll-edge pan that waits out a tap's wobble before cancelling MUST still cancel before a kept move could commit the native pan (DEC-29)." A new DEC-29 (Specs consistency ruling, applying DEC-18) records the Mobile Safari 27.0 measurement and BottomSheet's 5 px wobble. Rubric results below.Smallest restoration
One early
preventDefault()inuseSheetGestures's bodytouchmovehandler, gated on the same edge test the promotion uses, plus the constant that names the threshold. No API, no visual change, no change to the promotion itself.Evidence
Measured on the iOS 27.0 simulator (iPhone 17, Mobile Safari 27.0) with HID swipes on
core-bottomsheet--tall-sheet(a Tall sheet whose list sits at its top), reading the body'sscrollTop,pointercancel, and the firsttouchmove's travel anddefaultPreventedfrom the page.touchmovetravelled 4–8 px (kept by the page) ended inpointercanceland a bodyscrollTopof −131 to −135 px while the sheet followed the finger; 0 of 8 swipes whose first move travelled 14–16 px did. The same swipes on v0.6.0 (bodyoverscroll-behavior: nonethen) committed the pan too (6 of 6pointercancel) but moved nothing; the bounce began when the body moved tooverscroll-behavior: containwith the shared scroll area (v0.6.3), and it has been there since.core-bottomsheet--tall-sheetandcore-tokenizer--sheet-presentation) showpointercancelor a bodyscrollTopbelow 0; every move past 5 px is cancelled; the sheet follows the finger 1:1 (0 lag frames over 17 input frames per run) and the swipe dismisses.touchmoves is cancelled). Before this change a tap in a sheet whose content overflows kept its click up to 8 px of wobble; a tap in a hug sheet already lost it at 5 px through the scroll lock's page hold.useSheetGestures.test.ts— a top pull of 3 px is not cancelled and does not drag; 6 px is cancelled and does not drag yet; 9 px is cancelled and drags. The mirror for a bottom pull-up at a lower detent, and an upward move from the top that is left to the scroll.Scope
Testing
pnpm vitest run --project ui packages/core/src/BottomSheet/useSheetGestures.test.ts packages/core/src/BottomSheet/BottomSheet.test.tsx packages/core/src/BottomSheet/BottomSheetPanel.test.tsxpnpm check:knowledgecore-bottomsheet--tall-sheetand--snap-points(body and grabber).Writing rubric results
Maintainer carry (@cixzhang)
Carried forward on this branch with @imdreamrunner's commit kept, after the review:
main.>check), and DEC-29 records both measurements./pages/bottom-sheet-pull/, opens a sheet of 40 rows over a page that scrolls with the document, and shows the last row tapped. It is test surface only.Tap wobble at 2719e90
The cancel fires when a first move toward the scroll edge reaches 5 px, so the tap trade-off is the one DEC-29 records:
touchmoveis cancelled. The new test pins a 4 px move as not cancelled.touchmoveorpointercancel, and the pull never starts. The sub-5 px misses (about 25% at 3–4 px) also happen on a plain button and onmain's own sheet, so they come from WebKit's tap tolerance and this PR doesn't change them. At 5–6 px down, the new>= 5cancel drops the click (0 of 6), which is the stated trade. It matchesmain's existing sideways rule:PAGE_HOLD_SLOP = 5already drops 5–6 px sideways taps (0 of 6).Phone check (iPhone, Safari)
Preview at cd50f7f (the checked head): https://astryx-cruxgx5t9-fbopensource.vercel.app/sandbox/pages/bottom-sheet-pull/
Main merge at cd50f7f (DEC-31 carry does not apply)
main(2309691) is merged in at cd50f7f with no force-push and @imdreamrunner's commits kept. The one conflict wasapps/sandbox/scripts/next-export-routes.json, where both sides added a route; both are kept, sorted.The
spec:AST-094DEC-31 evidence carry was checked and does not apply, so the evidence is taken again at this head:mainchanged the surrounding context.mainchanged three files this PR changes (docs/specs/AST-094-touch-presentations/spec.md,apps/sandbox/src/app/sandboxPages.ts,apps/sandbox/scripts/next-export-routes.json).useSheetGestures.tschanged, and no shared motion or layer module changed (motion/transientCopy,motion/inertClone,motion/animator,Layer/useLayer,hooks/usePager).mainchangedBottomSheet/BottomSheet.tsx(fix(BottomSheet): a sheet whose close is suspended takes the scrim #10776: a suspended close takes the scrim), the component that hosts these gestures, so the felt behavior is checked again.A fresh real-iPhone check was due at this head; its result is below.
Real-device evidence at cd50f7f
main, so it's tracked separately.Second main merge at 4ad6d46 (evidence carries under DEC-31)
main(8a67045) is merged in at 4ad6d46, with no conflicts and no force-push. It picks up #10934, which fixes an unrelated CLI render test that the first merge brought in broken. Thespec:AST-094DEC-31 carry holds for the real-iPhone check at cd50f7f:main→cd50f7f4 andmain→4ad6d466.mainchanged since cd50f7f is a file this PR changes, aBottomSheet/file, a direct import ofuseSheetGestures.ts(gestures/VelocityTracker,motion/resolveSnapPoint,motion/rubberBand,motion/uikit/scroll,motion/uikit/sheet,BottomSheet/snapOffsets), or a shared motion or layer module (motion/transientCopy,motion/inertClone,motion/animator,Layer/useLayer,hooks/usePager).Commands:
git diff --name-only 2309691d 8a670454compared against those paths (no match), and a per-file comparison of the PR's added and removed lines (all identical).