Repository navigation
fix(useHover): prevent stuck hover state in useHover after touch interactions - #10824
Merged
Merged
Conversation
Contributor
|
LGTM :) |
snowystinger
approved these changes
Oct 21, 2026
reidbarber
enabled auto-merge
October 22, 2026 02:01
yihuiliao
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10823
On hybrid touch+mouse devices, elements can get stuck in an
isHoveredstate after a touch interaction.This is because in useHover,
triggerHoverEndclearedstate.targetbefore its early return for touch events. When a touch happened while an element was mouse-hovered, that element was left withisHovered = truebut notarget, so nothing could end the hover until it unmounted.This PR:
state.target/state.pointerTypeupdates intriggerHoverStartandtriggerHoverEndafter their early returns, so ignored touch events no longer change hover state.setGlobalIgnoreEmulatedMouseEvents, so a second tap within 500ms gets the full window for ignoring emulated mouse events.✅ Pull Request Checklist:
📝 Test Instructions:
Unit tests should cover this, but on a physical device with both touch and mouse, you can test this by going to the useHover docs example, then:
Previously the button would stay dark green (hover state) and the log would show "hover start with mouse" with no "hover end".
🧢 Your Project: