react-autocomplete
react-autocomplete copied to clipboard
ignoreBlur bug causing can't lose focus
hover on the last item of the menu, then type something that will shrink the menu.
i think when mouse leaves the menu without triggering the onMouseLeave callback it makes the component mistakenly think the mouse is still inside the input which cause the component always ignore blur.
Thanks for reporting this! I've started work on a fix, but sadly it will be very messy. I also notices that the current restore-scroll behaviour does not work as expected if Autocomplete
is inside a scrolled container that's not <body>
. My plan is to rethink how the focus management logic works, and hopefully that will negate the need for these dirty tricks :)
@CMTegner Have you given additional thoughts to this problem?
I am having a similar issue with my setup. I have a button in my autocompleter dropdown that hides the dropdown by toggling the open
props.
This of course circumvent the onMouseLeave
event, therefore never unsetting _ignoreBlur
.
This causes the autocompleter field to hog focus forever because you can't onMouseLeave
an element that is already hidden.
@vinhboy I'm afraid the entire logic needs a rethink. I hope to have time to address it soon, but I can't say for sure when this may be completed. If you can, try to work around the problem in your app so you don't get impeded by my ability to work on this issue.