Skip to content
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

fix: open/show debounce preventing tooltip from closing properly #1147

Merged

Conversation

johannkor
Copy link
Contributor

Closes #1144


There was an issue where the tooltip would stay open after the cursor
had already left the anchor element. The issue would arise if:

  • there are two (or more) tooltip anchors A and B (same tooltip ID)
  • mouse goes over A to show the tooltip, user waits for tooltip to show
  • mouse quickly (within 50ms) leaves A, goes over B, then leaves B.

The tooltip component applies debouncing on the show and hide events in
case e.g. an anchor is simultaneously focused and mouseovered. If the
second leave event occurred while that debounce was still active, it was
never processed.

This commit fixes the issue by making the show and hide debounce
functions reset each other. For example, if the hide debounce has an
active timeout, calling the debounced show function will now reset the
timeout of the hide debounce.

This solution still leaves the hide/show debounces effective against
double-show/double-hide.

There was an issue where the tooltip would stay open after the cursor
had already left the anchor element. The issue would arise if:
- there are two tooltip anchors A and B (same tooltip ID)
- mouse goes over A to show the tooltip, user waits for tooltip to show
- mouse quickly (within 50ms) leaves A, goes over B, then leaves B.

The tooltip component applies debouncing on the show and hide events in
case e.g. an anchor is simultaneously focused and mouseovered. If the
second leave event occurred while that debounce was still active, it was
never processed.

This commit fixes the issue by making the show and hide debounce
functions reset each other. For example, if the hide debounce has an
active timeout, calling the debounced show function will now reset the
timeout of the hide debounce.

This solution still leaves the hide/show debounces effective against
double-show/double-hide.
@danielbarion danielbarion changed the title Fix open/show debounce preventing tooltip from closing properly fix: open/show debounce preventing tooltip from closing properly Jan 2, 2024
Copy link
Member

@gabrieljablonski gabrieljablonski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Should be merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] When using default rt-transition-show-delay, tooltip stays in DOM after visibly closing
3 participants