Sometimes tooltips overlap with the element they are attached to.
This causes flickering when moving the mouse-cursor. (Because the cursor is sometimes detected moving over the attached element -- showing the tooltip -- and sometimes detected moving over the tooltip -- hiding it.
The tooltip shoud not be hidden when the cursor passes over it -- only when the cursor leaves the area of the attached element.
Moving the cursor over the tooltip closes it, even when the cursor is still over the attached element.
The steps to provoke this problem may seem a little odd, but never the less, this is a problem for me.
| Tech | Version |
|--------------|---------|
| Material-UI | 1.0.0-beta.38 |
| React | 16.2.0 |
| browser | Chrome |
Setting the css property "pointer-events: none" on the tooltip-popper does the trick.
It makes the tooltip beeing ignored for any kind of cursor-interaction.
Which is exactly what I would expect from a tooltip.
That fix works perfectly for what I'm using it for. Thanks @freund17
@freund17 Works for me as well! PR welcome!
Still happens on 1.0.0-beta.41
The code for the suggested solution is:
<Tooltip PopperProps={{ style: { pointerEvents: 'none' } }}>
...
</Tooltip>
@stefanwille but beware, pointer-events
are not yet supported by Safari :/ https://caniuse.com/#feat=pointer
@avetisk Wrong feature.
Directly from your link:
Not to be mistaken with the unrelated "pointer-events" CSS property.
Here is the correct one:
https://caniuse.com/#feat=pointer-events
;)
@freund17 馃憤
There's an easier way to replicate: https://codesandbox.io/s/v0zzv4jx93
Just place the tooltip inside a container with overflow: (auto|scroll)
And based on @freund17 's suggestion, the following theme override solves it for me:
MuiTooltip: {
popper: {
pointerEvents: 'none',
'&$open': {
pointerEvents: 'none'
}
}
}
Thanks @freund17, works for me too.
I have updated the reproduction to the latest version: https://codesandbox.io/s/4248q9vm0w.
Most helpful comment
The code for the suggested solution is: