You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure mouse doesn't active item/option while navigating using the keyboard (#3769)
This PR fixes an issue where the mouse will activate the `MenuItem` or
`ListboxOption` below the cursor position even if you are using the
keyboard while navigating the menu or listbox.
This behavior is now consistent between the Menu, Listbox and Combobox
components.
The reason this was happening is that we are scrolling the active item
into view when using the keyboard. That in turn triggers events such as
`pointerenter`, `mouseenter`, `pointerleave` and `mouseleave` even
though you didn't move your cursor. Luckily `mousemove` events are not
triggered in this case.
Now we will ensure that the activation trigger (what tool you used to
navigate: keyboard or mouse) is the same and that the mouse did in fact
move before activating the item under the cursor.
Fixes: #3739
## Test plan
### Before:
https://github.com/user-attachments/assets/39a46b82-58dd-4e20-b81c-94760511301a
The Combobox was already behaving correctly.
### After:
https://github.com/user-attachments/assets/4c90dfb3-e2bc-4202-b4a9-fe682d7d49cf
---------
Co-authored-by: Jordan Pittman <[email protected]>
0 commit comments