reactjs / react-autocomplete

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

New default behavior onMouseOut #301

Open vladimir-konnov opened 6 years ago

vladimir-konnov commented 6 years ago

Hello all!

I would like to propose new default behavior when user moves mouse out of the dropdown box: remove highlighting from last selected item. People are asking why the highlighting stays when you move mouse out of options list. I think it was done on purpose for the sake of selectOnBlur functionality. But now there's no ability to change this behaviour, no option in props list. So I'm proposing to remove highlighting by default when selectOnBlur is off.

Thank you

P.S. Though I proposed this as a default behavior, you'd probably like to add an option into props list to handle it explicitly. I'm also ok with that

CMTegner commented 6 years ago

Hi Vladimir! Wouldn't it be better to have this behaviour trigger when the cursor leaves the menu, and not each individual item? I haven't traced the code, but I think this change will cause twice as many state changes when the user's cursor moves between items.

vladimir-konnov commented 6 years ago

Hi CMTegner! I proposed this code in order to fix the case when user moves the cursor out of a menu item, the same like it highlights a menu item onMouseEnter. Well, from performance point of view I agree with you, it would be better to remove highlighting on mouse leaving the menu itself, not just a menu item. For the first glance it should work ok if you move the handler from menu item to menu itself.

viswanathm commented 6 years ago

Hi, I agree with Vladmir. I am using this control and facing some problem of not removing highlighted index on mouse out.

And moving mouseOut event from menu item to menu would improve the performance too.

When will this pull request be merged? I can probably move the mouseOut to menu from menuItem and raise new pull request.

It would be great if this can be addressed at the earliest.