reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

ignoreBlur bug causing can't lose focus #254

Open rhqD opened 7 years ago

rhqD commented 7 years ago

hover on the last item of the menu, then type something that will shrink the menu. ignoreblurbug 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.

CMTegner commented 7 years ago

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 :)

vinhboy commented 6 years ago

@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.

CMTegner commented 6 years ago

@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.