Skip to content

[select] Ignore a mouseup that already happened before the trigger listens - #6116

Closed
rohits2501 wants to merge 1 commit into
mui:masterfrom
rohits2501:fix/select-stale-mouseup
Closed

rohits2501 wants to merge 1 commit into
mui:masterfrom
rohits2501:fix/select-stale-mouseup

Conversation

@rohits2501

Copy link
Copy Markdown
Contributor

Fixes #6042.

A fast click can release the mouse before the deferred mouseup listener is armed. That { once: true } listener then stays registered, and the next mouseup outside the trigger closes the select with cancel-open.

The trigger still waits one task before listening, so a Firefox mouseup fired during mousedown does not close the popup. If that opening press has already ended, the close listener is not added.

Test plan

  • SelectTrigger.test.tsx: a same-turn release stays open after a later outside mouseup. The existing held-press cases still pass.
  • Docs Select demo in Chromium: a same-task click stays open after a later mouseup outside the trigger. A press held past the delay still closes when released off the trigger.

Made with Cursor

…stens

A click can end before the deferred close listener is armed, so the next unrelated mouseup was closing the popup.
@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown

commit: 4dd01a6

@code-infra-dashboard

code-infra-dashboard Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+296B(+0.06%) 🔺+83B(+0.05%)

Details of bundle changes

Performance

No regressions in 36 benchmarks · ran 2m 49s · details


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

@netlify

netlify Bot commented Oct 27, 2026

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

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

@rohits2501

Copy link
Copy Markdown
Contributor Author

Tested the reported cases on the deploy preview Select demo (https://deploy-preview-6116--base-ui.netlify.app/react/components/select), using the issue's same-task mousedown then mouseup on the trigger.

Reported case Runs Result
Fast click, then press the list padding and release outside 8 List stayed open all 8 times
Fast click, Escape, then click elsewhere 8 Stayed closed all 8 times. The opening listener did not run on that later click
Fast click, then click outside while open 5 Closed all 5 times from the outside press only. No leftover close listener ran
Slow click (60 ms), then the same drag out of the list 3 List stayed open all 3 times

On each fast click the only mouseup listener was the one that records the release. It ran once during that click and was removed. The later mouseup did not close the select with cancel-open.

@rohits2501

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #6048, which already fixes #6042.

@rohits2501 rohits2501 closed this Oct 27, 2026
@zannager zannager added the component: select Changes related to the select component. label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: select Changes related to the select component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[select] A fast click on the trigger leaves a stale mouseup listener that closes the Select later

2 participants