Skip to content
Discussion options

You must be logged in to vote

The issue is event bubbling. When you type in your search input, the keydown event bubbles up to SelectContent, which has built-in typeahead handling. It intercepts every single character you type and tries to match items.

The value disappearing is a separate but related issue. Radix Select uses a portal to display the selected item's text in the trigger. When your search filters out the currently selected item from the DOM, there's nothing left to portal, so the trigger goes blank.

The fix is pretty simple. Just stop the event from bubbling:

<input
  value={query}
  onChange={(e) => setQuery(e.target.value)}
  onKeyDown={(e) => e.stopPropagation()}
/>

For the disappearing value, pass ch…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lekhoinguyen06
Comment options

Answer selected by lekhoinguyen06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants