This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Svelte: QoL fixes for hover popovers#62974
Merged
Merged
Conversation
Adds a configurable hover delay to hover-enabled popovers.
Resets the delay on mousemove within the element so we only show the popover when the mouse comes to rest on the trigger element.
This closes the popover when the window loses focus and hover is enabled because losing focus means we can miss the mouse move event, which causes the popover to be stuck open.
This adds a small delay to closing the popover when the mouse leaves either the trigger element or the popover element so that there is some room for error when moving the mouse from the trigger into the popover.
Fetches data on hover so it's available in the cache.
74ac1cf to
4691cb6
Compare
camdencheek
commented
May 29, 2024
| node.removeEventListener('mouseenter', handleMouseEnterTrigger) | ||
| node.removeEventListener('mouseleave', handleMouseLeaveTrigger) | ||
| node.removeEventListener('mousemove', handleMouseMoveTrigger) | ||
| window.removeEventListener('blur', handleWindowLoseFocus) |
Member
Author
There was a problem hiding this comment.
There is one more situation that can cause this. If I re-tile my window so the window moves behind my mouse, a mouseleave event is not triggered and the popover does not disappear. The only way I could think of to get around this would be to add an event on mousemove and check if the mouse ever appears outside of the popover, but that sounded expensive
ead00e1 to
4565bd3
Compare
Previously, we were only hiding when a click occurred outside the target element. However, we already hide the popover in hover mode when the mouse leaves the popover and trigger. In this case, we want a click on the trigger to hide the popover.
547512d to
87f5a9b
Compare
vovakulikov
approved these changes
May 30, 2024
fkling
reviewed
May 30, 2024
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes SRCH-449
Each commit is granular and has a useful message describing the change.
In short:
hoverDelayparameter toPopoverso each consumer doesn't need to do this manuallyTest plan
Manual testing for feel. Would love if reviewers would pull this down and try it out on the file tree.
Video walkthrough