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] stick on screen when child is disabled

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I’m using the Tooltip component with a button as child, which get disabled when you click on it. The tooltip stay on screen when the button is disabled. The doc says to put a span before the disabled element, but it still have the same behavior.

Expected Behavior 🤔

The tooltip disappear onMouseLeave even if the child is disabled

Steps to Reproduce 🕹

I made a small Code SandBox example of the issue: https://codesandbox.io/embed/tooltip-disable-pqess

The first example is without the <span> tag enclosing the child. The second is with the <span> tag enclosing the child. When clicking on the button, it will get disabled. The tooltip stays displayed no matter what Steps:

  1. Hover the button: the tooltip get displayed (fine)
  2. Leave the button: the tooltip disappears (fine)
  3. Click on the button, the tooltip will still be displayed even if you leave it

Context 🔦

I’m using it to display an action button. So when you click it i fetch some data, and while fetching the button is disabled

Your Environment 🌎

Tech Version
Material-UI v4.3.0
React v16.8.6
Browser Chrome
TypeScript v3.2.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
oliviertassinaricommented, Aug 2, 2019

@Bixtrix What are you wrapping the tooltip with in your website? This does the trick:

<Tooltip title={text}>
  <span>
    <button
      style={ disabled ? { pointerEvents: "none" } : {}}
      disabled={disabled}
      onClick={doStuff}
    >
      {text}
    </button>
  </span>
</Tooltip>
1reaction
oliviertassinaricommented, Sep 13, 2019

@konekoya I would expect the mui buttons free from this problem. I think that a note about this limitation should be enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tooltip] stick on screen when child is disabled #16868 - GitHub
I'm using the Tooltip component with a button as child, which get disabled when you click on it. The tooltip stay on screen...
Read more >
Persistent tooltip - Microsoft Community
Right click My Computer. Select Properties. Go to the Advanced tab. Click the Settings button in the section labeled "Performance". Disable Show ......
Read more >
Bootstrap's tooltip doesn't disappear after button click ...
Once the ajax process completed, the button would become "available" again. Hovering on and then off of the button would dismiss the tooltip....
Read more >
Overlays | React-Bootstrap
Elements with the disabled attribute aren't interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround,...
Read more >
r/CrusaderKings - your life will be 1000 million percent better if ...
Hell, some of the first level tooltips are useless, like the highest perk ones "You gain the trait 'Scholar'", but without locking it...
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