Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
Add input and keyboard navigation in a custom Dropdown

I have created this custom Dropdown from scratch, it's inspired a bit by React Select and very similar to what I have to create at work. I'm happy with it, but I have a few blocking issues.

First of all, I'm trying to make the Dropdown "searchable". Basically the user can type something, to narrow down the list of options that can be selected. For this, I have implemented an <input type="text /> that receives focus when the menu is open. It's somewhat fine I guess, but the input must be wrapping around the width of the content it has, so currently it looks off. I guess this can be done with CSS.

Now, the next problem is related to the first point above. I'm trying to implement a keyboard navigation, basically move between the options with arrow up/down and be able to select an option with Enter. Since the input receives focus in this case, I don't know how to implement this keyboard navigation since it would conflict.

If I don't focus the input, then we can't type. So I am not sure what to do in this case.

Here's the Dropdown.

Here's an example of what I want to achieve. https://jquense.github.io/react-widgets/docs/Multiselect#overview

As you can see here, when opening the menu, the input is still focused, but we can also navigate with arrows through the menu options.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda