question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tooltip] Moving anchor can cause tooltip to stay in view after mouse move

See original GitHub issue
  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

If you have an open tooltip and an onClick handler on the anchor which moves the anchor out of focus of the mouse the tooltip should dismiss as the mouse is no longer over the element

Current Behavior

The tooltip remains open until a click somewhere else in the window is triggered, giving what appears to be a broken behaviour.

Steps to Reproduce

Codesandbox example Click the button and see the tooltip remain visible

Context

My use case is a little more complex than the above example, but this demonstrates the base problem. My element moves when clicking, but the tooltip remains visible. There’s no easy way to dismiss it other than creating a completely controlled component and handling mouse events manually.

There may be some cases where dismissing on click isn’t the desired behaviour, so it may be preferable to have this as an option (e.g. dismissOnClick={true}) or exposing a call that can dismiss the tooltip (e.g. this.ref.tooltip.close())

Your Environment

Tech Version
Material-UI v1.4.1
React v16.4.1
browser Chrome 68

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Thomas101commented, Aug 2, 2018

Okay, thanks for looking into it and following up.

By the way great work on material-ui. We love it 😃

1reaction
oliviertassinaricommented, Jul 27, 2018

~@Thomas101 Well, https://github.com/mui-org/material-ui/issues/12289#issuecomment-408262317 might enable you not to have to control the tooltip. Maybe you could try this change internally?~

I will try something out, but I doubt we can do much about it without relying on a Mutation observable that is not yet widely supported by the browsers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tooltip] Moving anchor can cause tooltip to stay in view after ...
The tooltip remains open until a click somewhere else in the window is triggered, giving what appears to be a broken behaviour. Steps...
Read more >
HTML-Tooltip position relative to mouse pointer - Stack Overflow
One solution for multiple elements is to update all tooltip span 's and setting them under the cursor on mouse move.
Read more >
Dynamic Tooltip in Unity! (Resizable, Follows Mouse, Edge ...
Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=YUIohCXt_pcLet's build a Dynamic Tooltip that can resize ...
Read more >
Tooltips in the time of WCAG 2.1 | Sarah Higley
Focus and hover. The first step is to ensure that the visual display can be controlled by either a keyboard or a mouse....
Read more >
Tooltips · Bootstrap v5.0
When triggered from hyperlinks that span multiple lines, tooltips will be centered. Use white-space: nowrap; on your <a> s to avoid this behavior....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found