react-autocomplete icon indicating copy to clipboard operation
react-autocomplete copied to clipboard

ignoreBlur bug causing can't lose focus

Open rhqD opened this issue 7 years ago • 3 comments

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.

rhqD avatar Jun 29 '17 06:06 rhqD

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 avatar Aug 04 '17 10:08 CMTegner

@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 avatar Feb 16 '18 07:02 vinhboy

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

CMTegner avatar Feb 24 '18 16:02 CMTegner