[select] Allow mouse selection without highlight#4699
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,144.98 ms ▼-158.45 ms(-12.2%) | Renders: 50 (+0) | Paint: 1,774.50 ms ▼-232.06 ms(-11.6%)
…and 7 more — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Confirmed that this is a partial fix for #4698. Options can be selected with mouse events, but the hover state does not appear.
|
671c159 to
0fa7ad2
Compare
0fa7ad2 to
f64bda4
Compare
Code Review (GPT-5.5)Approve ✅ — the branch fixes the unhighlighted mouse-selection regression while preserving the alignItemWithTrigger opening-release guard and the drag-to-select fast path, with focused Select coverage passing in both JSDOM and Chromium. 1. Bugs / Issues (None)No actionable issues found in the current branch diff. Root Cause & Patch AssessmentThe previous selection guard conflated “this item is highlighted” with “the user intended to select this item.” That broke real mouse selection whenever hover highlighting was disabled or unavailable. The patch now tracks mouse intent separately:
Moving the drag accumulator into Edge Cases Worth NotingThe small-movement behavior is now covered both ways: a small pointer movement does not unlock the fast drag path before the opening delay, but it also does not permanently block selection after the delay elapses. The 400ms opening guard is simpler than the previous selected/unselected split and matches the safer behavior for cases where the popup opens under a neighboring item rather than the selected item. Test Coverage AssessmentThe added tests cover the main regression and adjacent guardrails:
Validation run on the final squashed branch: pnpm prettier
git diff --check
pnpm test:jsdom SelectItem --no-watch
pnpm test:chromium SelectItem --no-watch
pnpm test:jsdom SelectRoot --no-watch
pnpm test:chromium SelectRoot --no-watch
pnpm typescript
pnpm size:snapshotThe regression tests were not run against |

Partially addresses #4698
Closes #4663
Mouse selection could become a no-op when a Select item was not highlighted, even if the user clicked or drag-selected the item intentionally. This allows real mouse selection to commit when the press starts on the item, while keeping the guard for
alignItemWithTriggercases where an item appears under the cursor as the popup opens.This does not claim to fix the underlying
[data-highlighted]styling/registration issue; it only prevents mouse selection from bailing when highlight state is unavailable. For #4663, it only addresses pointer selection becoming a no-op; it does not make nested Accordion content a supported Select composition.Changes
Select.Itemto select even when the item is not highlighted.highlightItemOnHoveris disabled.