onBlur dropdown issue

That makes sense since your dropdown is outside your input, so when you click on it, it in fact removes focus from the input.

Your best solution here would be to wrap both of them in a div (or whatever else) and close the dropdown when an option is selected, or when clicked outside that div. Here’s a CodeSandbox I made:

https://codesandbox.io/s/fragrant-bash-og2mq?file=/src/App.js

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top