Repository navigation
[drawer] Commit swipe on primary-button release - #5057
Merged
Merged
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,283.10 ms +22.63 ms(+1.8%) | Renders: 78 (+0) No significant changes — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
atomiks
marked this pull request as ready for review
June 17, 2026 03:05
atomiks
requested review from
colmtuite,
flaviendelangle and
michaldudak
as code owners
June 17, 2026 03:05
michaldudak
approved these changes
Jun 17, 2026
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
Fast trackpad flicks failed to dismiss the drawer (and to skip snap points) on some machines — the gesture snapped back instead of releasing. Touch input (and DevTools touch emulation) worked perfectly, which isolated it to the pointer/mouse path.
On a fast trackpad flick the click releases a hair before the cursor's final move, so the browser dispatches a trailing
pointermovewithbuttons: 0beforepointerup. The existing guard treated that as "primary button lost → cancel → restore", so the swipe was already dead by the timepointerupran and no release decision ever happened.It's timing/hardware-sensitive: the trailing
buttons: 0move only shows up when the trackpad reports a lift-off sample and the display refresh is low enough (~60Hz) that the browser coalesces it next topointerup. So it reproduced on a 60Hz MacBook but not a 120Hz ProMotion one.Fix
A primary-button release is a commit, not a cancel. The
buttons: 0-during-swipe branch now routes tohandleEnd(the same path aspointerup/touchend) instead ofcancelSwipeInteraction:Touch never enters this
!('touches' in event)branch, which is why touch was unaffected. The change still ends the gesture on release, so it doesn't reintroduce the historical "stuck drag" bugs (release landing on the document /pointercancel).Tests
Added
commits the swipe when the primary button is released past the threshold without pointerup. Existing button-release, right-click-cancel, and document-release/pointercancelstuck-drag regressions all still pass (Drawer + Toast, jsdom + Chromium).