Repository navigation
fix(core): a bottom-edge pull-up no longer hijacks a fully expanded Bottom Sheet - #5161
Merged
Merged
Conversation
…ottom Sheet At the tallest detent an upward pull at the end of the scrolling content was promoted into a sheet drag with nowhere to expand to. The travel landed in the rubber-band branch (0.35x, capped at 48px) and the release threw it straight back, and — because promotion preventDefault()s the rest of the gesture — the scroller stayed dead until the finger lifted, so reversing downward to scroll back collapsed the sheet a detent instead of scrolling. Arm the bottom edge for handoff only when a taller detent exists. The top-edge pull-down handoff and the mid-detent expand are unchanged. The old test asserted only that the promotion happened; it now asserts the sheet actually travels, plus two regressions for the tallest detent.
|
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 |
imdreamrunner
marked this pull request as ready for review
August 17, 2026 19:32
imdreamrunner
marked this pull request as draft
August 17, 2026 19:37
imdreamrunner
marked this pull request as ready for review
August 17, 2026 20:03
This was referenced Aug 18, 2026
imdreamrunner
added a commit
that referenced
this pull request
Aug 18, 2026
…5172) A swipe that scrolls to the end of the sheet's content and keeps pulling stopped dead at the last line. Arming was decided once, at touchstart: a finger that landed mid-content stayed a scroll for the whole gesture, so the motion people actually perform -- swipe up through the list, reach the bottom, keep pulling -- never reached the sheet. Only a fresh touch that started already at the edge handed off, which is why every scripted repro said the bottom edge was fine. Re-arming on every move and promoting with preventDefault() cannot fix it: once the browser has committed the gesture to scrolling, the remaining touchmoves are non-cancelable (measured in Chrome: 40 moves in the gesture, 12 with the scroller at its end, 0 of them cancelable). Nothing needs cancelling either -- the scroller is clamped at its maximum, so further upward travel scrolls nothing. So the body now tracks every touch, notes where the finger was when the content ran out, and drives the sheet from the travel beyond that point: no jump, and the part of the swipe that legitimately scrolled stays with the content. The handoff yields again if the finger comes back down (the native scroll it handed off from was never cancelled, and two things moving at once is the failure mode), and never fires with no taller detent to expand into, the #5161 rule. Verified in Chrome (~/sheet-repro/continuous-handoff-suite.mjs): the continuous pull expands the sheet 450 -> 342, while mid-content scrolling, the top-edge pull-down, the momentum tail, the reversal, and the tallest-detent case are unchanged.
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.
Summary
At its tallest detent, a Bottom Sheet with scrolled content stole an upward
pull that belonged to the scroller. The sheet lifted a little, stopped short of
the finger, and sprang back — and for the rest of that gesture the content
could not scroll at all.
onTouchStartarmed the bottom edge for handoff whenever the scroller was atits end, without asking whether the sheet had anywhere to expand to. At the
tallest detent
baseOffset === 0, so every upward pixel landed in therubber-band branch of
handlePointerMove(OVERSCROLL_RESISTANCE = 0.35,capped at
OVERSCROLL_MAX = 48) andsettleFromDragreturned it to 0. Themeasured lift was exactly
min(0.35 × d, 48), thrown back over ~225ms.The worse half is the captured gesture. Once promoted,
dragStateRefisset and every later
touchmoveispreventDefault()ed, so native scrollingstays dead until the finger lifts. Overshoot the end of a list by a few pixels,
drag back to scroll, and the sheet collapses a detent instead — from a mid
detent the same gesture drove the sheet to
top: 810on a 900px viewport, onenudge from dismissal.
The bottom edge hands off so the sheet can expand, so it is only a handoff
when a taller detent exists:
activeOffsetRefis refreshed every render and equalssettledOffsetwhen nodrag is in flight, so it is the live answer to "is there room to expand" — no
new state, no stale closure.
Measured
Capped-height story, 500×900, content scrolled to the bottom:
One gesture, fully open: pull up 60px, then reverse down 300px.
Unchanged and re-verified: top-edge pull-down collapse, mid-detent
expand-by-pull-up (450 → 342), fully-open + at-top + finger-up scrolling, and
scrollPreservationInsethealing. Same on the hug-height story.Risk
Public API unchanged. One deliberate behavior change beyond the bug: on a sheet
whose content does not scroll at all,
atTopandatBottomare both true, soan upward pull used to rubber-band there too. It no longer does. The body
already sets
overscrollBehavior: 'none', so "no bounce at the end" is theestablished choice here, and the grab handle remains the affordance for moving
the sheet. Happy to restore the bounce for that case if reviewers prefer it.
Touch-only. The pointer path never armed the bottom edge —
handleBodyPointerDownreturns early whenscrollTop > 0— so mouse-drivenharnesses cannot see any of this, before or after.
Testing
useSheetGestures.test.ts— the existing case asserted onlyisDragging === true, which the bug satisfied: the promotion was real, thetravel was worthless. It now asserts the sheet actually follows the finger, and
two regressions pin the tallest detent:
promotes a bottom pull-up (touch) into a sheet drag that travels— settlesat a lower detent first, then asserts
dragOffsettracks the finger 1:1leaves a bottom pull-up with the scroller at the tallest detentdoes not preventDefault a bottom pull-up at the tallest detent— pins thereversal case via
defaultPreventedBoth regressions fail on the unfixed source and pass with the fix.
vitest run packages/core/src/BottomSheet/— 142 passpnpm check:repo, eslint,tsc --noEmit— cleanScope
This PR only stops the sheet from taking a gesture it cannot use. The
scroll-to-the-bottom-then-pull-up handoff is unchanged and verified: at a mid
detent with content at its end, an upward pull tracks the finger 1:1 (40px →
40.0, 60px → 60.0, 80px → 80.0) and settles expanded. Direct expansion from any
scroll position remains the grab handle's job.
Whether an upward drag should expand a sheet beyond its opening height is a
separate question, tracked in #5087.