Skip to content

fix(mic-selector): don't change value on hover or arrow navigation - #467

Open
ephraimduncan wants to merge 1 commit into
vercel:mainfrom
ephraimduncan:fix/mic-selector-hover-selection
Open

fix(mic-selector): don't change value on hover or arrow navigation#467
ephraimduncan wants to merge 1 commit into
vercel:mainfrom
ephraimduncan:fix/mic-selector-hover-selection

Conversation

@ephraimduncan

Copy link
Copy Markdown

Once a microphone was selected (or defaultValue was set), merely hovering a row or arrowing through the open list fired the consumer's onValueChange and changed the trigger — as if that device had been chosen. The value now changes exactly once, when an item is activated, and opening the popover still highlights the currently selected device.

Cause: cmdk's root value tracks the highlighted item, and MicSelectorContent bound it to the public selection state — so once the component had a value (controlled mode), every pointer-move and arrow-key highlight change was reported as a selection. MicSelectorItem.onSelect was already the correct commit point; the root Command now receives only defaultValue={value} for initial highlight.

Added two regressions: hover + ArrowDown/ArrowUp leaves the onValueChange spy untouched (fails against the previous implementation), and keyboard activation fires exactly one change and closes the popover. 32/32 tests in the file pass.

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@ephraimduncan is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant