Skip to content

[Select] Fix flaky opening mouseup timing - #49024

Open
michelengelen wants to merge 1 commit into
mui:masterfrom
michelengelen:fix/select-opening-mouseup-flake
Open

[Select] Fix flaky opening mouseup timing#49024
michelengelen wants to merge 1 commit into
mui:masterfrom
michelengelen:fix/select-opening-mouseup-flake

Conversation

@michelengelen

Copy link
Copy Markdown
Member

Fixes a flaky WebKit failure in Select > pointer interactions > closes when the opening mouseup lands on the selected option after the selected-item delay.

The problem

SelectInput starts the selected-item timer inside the unselected timer's callback. The chain runs 200ms + 200ms. Each setTimeout adds its own jitter, so the real window drifts past 400ms on a loaded runner. The test slept 450ms, a 50ms margin. WebKit on CI misses that margin, the mouseup arrives while allowSelectedMouseUp is still false, and the menu never closes.

The fix

  • Start both timers from the mousedown. The unselected timer runs 200ms. The selected timer runs the full 400ms (SELECTED_MOUSE_UP_DELAY). The jitter no longer compounds, and the flat delay matches the existing code comments.
  • Widen the test sleeps: 450ms → 700ms for the selected-item window, 250ms → 400ms for the two drag-delay tests. The drag tests had the same 50ms margin.

Both timers were already cleared together in clearSelectionTimers, so no cleanup path depended on the nesting.

Test plan

  • pnpm test:browser Select -t "pointer interactions" passes in WebKit and Chromium (22 tests).
  • pnpm test:unit Select passes in jsdom (407 tests).

🤖 Generated with Claude Code

https://claude.ai/code/session_013HgD6GEW3UxNRvC2abbTy9

The selected-item timer started inside the unselected timer's callback.
The chain compounds setTimeout jitter past the 400ms window. Slow CI
runners then miss the window and the WebKit test fails.

Start both timers from the mousedown instead. Widen the test sleeps to
give the timers real headroom.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013HgD6GEW3UxNRvC2abbTy9
@code-infra-dashboard

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49024--material-ui.netlify.app/
QR code for https://deploy-preview-49024--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+2B(0.00%) ▼-2B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


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

@zannager zannager added the scope: select Changes related to the select. label Aug 24, 2026
@zannager
zannager requested a review from silviuaavram August 24, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: select Changes related to the select.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants