Skip to content

[drawer] Commit swipe on primary-button release - #5057

Merged
atomiks merged 4 commits into
mui:masterfrom
atomiks:claude/confident-cartwright-82c9c8
Jun 17, 2026
Merged

atomiks merged 4 commits into
mui:masterfrom
atomiks:claude/confident-cartwright-82c9c8

Conversation

@atomiks

@atomiks atomiks commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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 pointermove with buttons: 0 before pointerup. The existing guard treated that as "primary button lost → cancel → restore", so the swipe was already dead by the time pointerup ran and no release decision ever happened.

It's timing/hardware-sensitive: the trailing buttons: 0 move 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 to pointerup. 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 to handleEnd (the same path as pointerup/touchend) instead of cancelSwipeInteraction:

  • Past threshold / fast flick → dismisses (the bug)
  • Sub-threshold → restores, exactly as before
  • Only a genuine non-primary button takeover (right-click) still cancels

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/pointercancel stuck-drag regressions all still pass (Drawer + Toast, jsdom + Chromium).

@pkg-pr-new

pkg-pr-new Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5057
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5057
    

commit: c4b7465

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+65B(+0.01%) 🔺+5B(0.00%)

Details of bundle changes

Performance

Total 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.

@netlify

netlify Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c4b7465
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a32411e97f1dc00085be13a
😎 Deploy Preview https://deploy-preview-5057--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 added type: bug It doesn't behave as expected. component: drawer Changes related to the drawer component. labels Jun 17, 2026
@atomiks
atomiks marked this pull request as ready for review June 17, 2026 03:05
@atomiks
atomiks merged commit b167c85 into mui:master Jun 17, 2026
6 checks passed
@atomiks
atomiks deleted the claude/confident-cartwright-82c9c8 branch June 17, 2026 06:45
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.

2 participants