-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore mouse move/leave events when the cursor hasn’t moved #2069
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
A mouse enter / leave event where the cursor hasn’t moved happen only because of: - Scrolling - The container moved
419e8fe
to
6d4c8fb
Compare
@RobinMalfait I've tweaked the implementation slightly with how it bypasses checks during tests. It now only does so for the pointer event calls in JSDOM. I use an env var to do this which required a tweak to the build script to make sure it was removed at compile time for release builds. Any worries with this approach? If not them I'll merge this in. |
A mouse enter / leave event where the cursor hasn’t moved could only happen because the container moved under the cursor. This is typically the result of scrolling the parent container (but could because by other move-related situations as well, if you're moving things around with JS for instance).
Some browsers (like Chrome) will prevent these events from firing when a scroll would've caused them; however, Safari isn't smart enough to do this (or maybe it's an intentional decision — not sure).
Regardless, this is not a desirable behavior because when using the up/down arrows to move through a list the mouse move event will trigger if it happens to be in the area where an option would move to causing the focus to move to an option other than the one you intended.
@RobinMalfait pls tell me this makes sense lol
Should fix this once things are merged, tagged, and updated: tailwindlabs/tailwindui-issues#1378