Skip to content

Combo box can't add space in input #1687

Answered by adamwathan
aliakbarazizi asked this question in Help
Discussion options

You must be logged in to vote

Hey! This is because you've wrapped your Combobox.Input in a Combobox.Button and the space key is propagating up to the button and triggering a click. Don't put the input in the button, the input should be on it's own like in our docs:

    <Combobox value={selectedPerson} onChange={setSelectedPerson}>
      <Combobox.Input onChange={(event) => setQuery(event.target.value)} />
      <Combobox.Options>
        {filteredPeople.map((person) => (
          <Combobox.Option key={person} value={person}>
            {person}
          </Combobox.Option>
        ))}
      </Combobox.Options>
    </Combobox>

The Combobox.Button component is an optional component you can use to manually open/close t…

Replies: 2 comments 1 reply

Comment options

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

Answer selected by aliakbarazizi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1685 on July 16, 2022 10:38.