Skip to content

[slider] End drags on touchcancel and pointercancel - #5639

Merged
atomiks merged 4 commits into
mui:masterfrom
brijeshb42:orc/issue-5637-84fa6ee0-62b2-45a3-b976-f56e5ef9df72
Sep 24, 2026
Merged

atomiks merged 4 commits into
mui:masterfrom
brijeshb42:orc/issue-5637-84fa6ee0-62b2-45a3-b976-f56e5ef9df72

Conversation

@brijeshb42

@brijeshb42 brijeshb42 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5637

When the browser cancelled a slider drag with touchcancel or pointercancel, nothing ended it. The document listeners stayed armed, so the next pointerup anywhere on the page committed the abandoned value.

This PR ends the drag on touchcancel, and on pointercancel for mouse and pen drags, through the same path as a release. It commits the value the thumb was left at and removes the listeners. The value was already applied through onValueChange, so committing it keeps onValueCommitted in sync with what the slider shows.

A pointercancel is ignored while the touch listeners are tracking the finger. Without touch-action: none, Chrome cancels the pointer as soon as a touch drag starts panning but keeps sending touch events, so ending the drag there would stop it partway through.

@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 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@5639
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5639
    

commit: afcd7a5

@code-infra-dashboard

code-infra-dashboard Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+230B(+0.05%) 🔺+42B(+0.03%)

Details of bundle changes


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

@netlify

netlify Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit afcd7a5
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6ab4ea2015b5aa000801a3f4
😎 Deploy Preview https://deploy-preview-5639--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.

@brijeshb42
brijeshb42 marked this pull request as draft September 5, 2026 16:57
@brijeshb42 brijeshb42 added component: slider Changes related to the slider component. type: bug It doesn't behave as expected. labels Sep 5, 2026
@atomiks atomiks changed the title [slider] End the drag on pointercancel/touchcancel without committing [slider] End drags on touchcancel and pointercancel Sep 24, 2026
@atomiks
atomiks marked this pull request as ready for review September 24, 2026 09:14
@atomiks
atomiks merged commit e29ae4c into mui:master Sep 24, 2026
23 of 24 checks passed
@brijeshb42
brijeshb42 deleted the orc/issue-5637-84fa6ee0-62b2-45a3-b976-f56e5ef9df72 branch September 24, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Slider] A cancelled touch drag leaves document listeners armed; the next tap anywhere commits the stale value

2 participants