[Tooltip] Add disabled prop
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
I found this issue which is vaguely related, I think: #1500
Summary 💡
Sometimes it’s useful to have an uncontrolled tooltip for, say, an icon button that opens a menu. When the menu is open, the tooltip might overlap with the menu, so it’s best to hide it.
Now, you can hide the tooltip by setting the title to an empty string, but this has the issue that the tooltip suddenly collapses while fading away, which is not very nice. I’ve tried other ways like disabling the listeners but that causes a lot of problems.
Making the tooltip controlled and manually implementing the event listeners and all is overkill for just this thing.
I think it could be easily solved with a disabled
property, so that it can be safely disabled without this ugly UI issue while remaining uncontrolled.
Examples 🌈
Instead of:
<Tooltip title={menuOpen ? '' : tooltip} />
Do:
<Tooltip disabled={menuOpen} />
Motivation 🔦
I can share the app I’m building with you if you need more details of a real use-case. Just ask.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:13 (7 by maintainers)
Top GitHub Comments
Okay, well in case anybody has this same issue, here’s a workaround:
Use this component as a drop-in replacement of Toolbar with the additional
disabled
property.I meant that I do understand what you’re seeing but not how we can reproduce this with Material-UI.