Skip to content

[drawer] Ignore swipes without an attributed direction when using snap points - #5477

Open
atomiks wants to merge 3 commits into
mui:masterfrom
atomiks:claude/drawer-snap-points-issue-f0647f
Open

[drawer] Ignore swipes without an attributed direction when using snap points#5477
atomiks wants to merge 3 commits into
mui:masterfrom
atomiks:claude/drawer-snap-points-issue-f0647f

Conversation

@atomiks

@atomiks atomiks commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #5471

With snapPoints, the release logic decides to close from the vertical delta and release velocity alone. A mostly horizontal flick with a fast downward arc at lift passes those checks even though useSwipeDismiss never attributed a swipe direction to the gesture. The viewport then commits the closing choreography (data-ending-style, data-swipe-dismiss, snap point set to null), but the hook drops the release decision because it has no dismiss direction, so onOpenChange never fires and the popup stays visually dismissed while open remains true.

Changes

  • When the gesture has no attributed direction, a would-close release settles on the nearest snap point instead of dismissing. Snap point navigation keeps working exactly as before for these gestures, since the sheet tracks their vertical component during the drag; only the close outcome is suppressed. The close is not deferred to the hook's fallback threshold loop because that loop checks both vertical directions when snap points are configured and would bypass the snap logic.
  • Unattributed releases also reset nested swipe state, which the hook's deduped trailing progress update cannot do, so a nested parent no longer keeps data-nested-drawer-swiping and a stale swipe progress.
  • Added regression tests for the unattributed fast flick, unattributed snap navigation, and nested cleanup.

@atomiks atomiks added component: drawer Changes related to the drawer component. type: bug It doesn't behave as expected. labels Aug 13, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026

Copy link
Copy Markdown

commit: 5b1a593

@code-infra-dashboard

code-infra-dashboard Bot commented Aug 13, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+91B(+0.02%) 🔺+21B(+0.01%)

Details of bundle changes

Performance

Total duration: 1,219.53 ms +12.95 ms(+1.1%) | Renders: 76 (+0) | Paint: 1,922.31 ms +36.30 ms(+1.9%)

Test Duration Renders
Menu open (500 items) 81.09 ms 🔺+19.01 ms(+30.6%) 11 (+0)
Select open (500 options) 53.16 ms 🔺+12.02 ms(+29.2%) 14 (+0)

13 tests within noise — details

Metric alarms

Test Metric Change
Menu open (500 items) bench:paint 🔺 +31.49 ms
Menu open (500 items) bench:paint#menu-open 🔺 +31.49 ms
Select open (500 options) bench:paint 🔺 +31.51 ms
Select open (500 options) bench:paint#select-open 🔺 +31.51 ms

Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 5b1a593
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a7d43bcc2e8ca00084c8dbd
😎 Deploy Preview https://deploy-preview-5477--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks
atomiks force-pushed the claude/drawer-snap-points-issue-f0647f branch from bd14ad7 to 5b1a593 Compare August 13, 2026 04:10
@atomiks
atomiks marked this pull request as ready for review August 13, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: drawer Changes related to the drawer component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[drawer] With snapPoints, a swipe can dismiss the popup visually while onOpenChange never fires

1 participant