Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!