Repository navigation
fix(core): let the Bottom Sheet be dragged up from its scroll area on iOS - #5178
Merged
Merged
Conversation
… iOS Below the tallest detent, a pull up inside the sheet's content did nothing on a real device while the grab handle worked fine. iOS Safari raises PointerEvents for a finger under the SAME numeric id it puts in `Touch.identifier`. The touch path builds its pointer-shaped event out of that identifier, so the drag it starts is keyed to a live pointer: `beginDrag` captures it, WebKit takes the capture straight back for its own gesture handling, and the `lostpointercapture` that follows a millisecond later cancels the drag one event after it began. Measured on iOS 26.5, one gesture: touchmove #1 -> promote, beginDrag gotpointercapture pointerId=-1239851261 (= the Touch.identifier) lostpointercapture pointerId=-1239851261 willCancel=true cancelDrag touchmove #2..#50 drag gone; the sheet ignores the rest of the pull Chromium keeps the two id spaces apart, so emulated touch never reproduces it; the unit tests stub `setPointerCapture`, so jsdom never fires the cancelling event. The handle keeps working because it runs on real pointer events, which legitimately hold the capture. The mid-gesture content-end handoff (#5172) usually survives only by timing: it promotes after WebKit has already given up that pointer at scroll commit. Touch-driven drags are now marked as such. They take no pointer capture, and `lostpointercapture`, `pointercancel` and `pointermove` for the same finger no longer cancel, end, or double-drive them. Test Plan: - Two new cases in useSheetGestures.test.ts dispatch onLostPointerCapture and onPointerCancel with a pointerId equal to the touch identifier. Both fail on main ("expected false to be true") and pass here. - packages/core/src/BottomSheet suite: 163/163. - On an iPhone 17 Simulator (iOS 26.5), one continuous touch per case, sheet at the 0.5 detent; numbers are the scrolling body's height, 309 = mid detent, 395 = fully open: | case | before | after | |------------------------------------------|-------------|-----------| | fresh touch at the content end, pull up | 309 (inert) | 309 -> 395| | scroll to the end mid-gesture, keep pull | 309 -> 395 | unchanged | | top-edge pull-down in the body | 395 -> 309 | unchanged | | ordinary mid-content scroll | scroll only | unchanged | | grab-handle drag | works | works | - tsc --noEmit clean; lint:strict 0 errors.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBottomSheet (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
github-actions
Bot
deleted the
fix/bottom-sheet-ios-pointer-id-collision
branch
August 19, 2026 06:11
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(core): let the Bottom Sheet be dragged up from its scroll area on iOS
The bug
With the sheet resting below its tallest detent, a pull up inside the
scrolling content does nothing on a real device. The grab handle drags the
same sheet perfectly. Reported as "I can drag up using the little bar, but I
can't drag up using the scroll area."
Not a gating or geometry problem — the sheet does take the gesture, and then
loses it one event later.
Root cause:
Touch.identifierandPointerEvent.pointerIdare the samenumber on iOS
The body's touch path drives the shared drag machinery by handing it a
pointer-shaped object built from a
Touch. On WebKit the id it copies out oftouch.identifiernames a live pointer — so the drag is keyed to a realone, and the handlers that exist to protect a mouse drag fire against it.
Instrumented, one gesture on iOS 26.5 / Safari 26.5 (iPhone 17 Simulator),
@astryxdesign/[email protected], sheet at the 0.5 detent, contentparked at its end:
beginDragcallssetPointerCapture(event.pointerId). Because that id is areal pointer the capture succeeds; WebKit reclaims it immediately for its own
gesture handling;
handleLostPointerCapturesees a matching id and cancels.The promotion had already nulled
touchDragRef, so nothing re-arms and theremaining ~50 moves do nothing.
Why nothing caught this
under DevTools touch emulation the synthetic id never matches a live pointer
and no
lostpointercaptureever arrives. Every scripted repro to date wasChromium.
makeTarget()stubsel.setPointerCapture = vi.fn(), so capture never happens and jsdom neverfires the cancelling event.
legitimately hold the capture.
timing: it promotes after WebKit has already fired
pointercancel+lostpointercapturefor that finger at scroll commit, so there is no livecapture left to lose. The armed-edge path promotes on the first move,
while the pointer is still live, and loses the race every time.
The fix
Mark the pointer-shaped objects the touch path synthesises, and keep
real-pointer handling off the drags they start:
touchmoveon the scrolleritself and never needed one.
lostpointercaptureis ignored for such a drag — it is WebKit reclaimingits own pointer, not the drag losing its grip.
pointercancel/pointerupfor that finger no longer end it. Theyarrive carrying the drag's own id;
touchendis what finishes a touch drag.(Ending on
pointercancelwould settle the sheet mid-pull.)pointermovefor that finger no longer double-drives it.Verification
New unit tests dispatch
onLostPointerCaptureandonPointerCancelwith apointerIdequal to the touch identifier — the collision, reproduced in jsdom.Both fail on
main(expected false to be true) and pass here, so CI holdsthis without a device.
On an iPhone 17 Simulator (iOS 26.5), one continuous touch per case, sheet at
the 0.5 detent. Numbers are the scrolling body's height: 309 = mid detent,
395 = fully open. The "after" column is a build of this branch's source, not a
hand-patched bundle.
Only the reported case changes.
packages/core/src/BottomSheetsuite 163/163;tsc --noEmitclean;lint:strict0 errors.