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

[Tooltip] Flickers when overlaped with element it is attached to #10735

Closed
1 task done
freund17 opened this issue Mar 20, 2018 · 10 comments
Closed
1 task done

[Tooltip] Flickers when overlaped with element it is attached to #10735

freund17 opened this issue Mar 20, 2018 · 10 comments
Assignees
Labels
bug 🐛 Something doesn't work component: speed dial This is the name of the generic UI component, not the React module! component: tooltip This is the name of the generic UI component, not the React module!
Milestone

Comments

@freund17
Copy link

freund17 commented Mar 20, 2018

apr-20-2018 11-03-59

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.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

The tooltip shoud not be hidden when the cursor passes over it -- only when the cursor leaves the area of the attached element.

Current Behavior

Moving the cursor over the tooltip closes it, even when the cursor is still over the attached element.

Steps to Reproduce (for bugs)

  1. Create a button (can be any element)
  2. Wrap it in a tooltip
  3. Set the css of the buttons parent to:
  • overflow: auto
  • overflow-y: hidden
  1. The Tooltip should now overlap with the button
  2. Hover over the area where the button intersects with the tooltip
  3. You should be able to observe the flickering

Sandbox

Context

The steps to provoke this problem may seem a little odd, but never the less, this is a problem for me.

Your Environment

Tech Version
Material-UI 1.0.0-beta.38
React 16.2.0
browser Chrome

Possible Solution

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.

@oliviertassinari oliviertassinari added the component: tooltip This is the name of the generic UI component, not the React module! label Mar 20, 2018
@abglassford
Copy link

That fix works perfectly for what I'm using it for. Thanks @freund17

@franklixuefei
Copy link
Contributor

@freund17 Works for me as well! PR welcome!

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Mar 31, 2018
@stefanwille
Copy link

Still happens on 1.0.0-beta.41

@stefanwille
Copy link

The code for the suggested solution is:

<Tooltip PopperProps={{ style: { pointerEvents: 'none' } }}>
  ...
</Tooltip>

@oliviertassinari oliviertassinari added this to the post v1.0.0 milestone Apr 20, 2018
@avetisk
Copy link
Contributor

avetisk commented Apr 20, 2018

@stefanwille but beware, pointer-events are not yet supported by Safari :/ https://caniuse.com/#feat=pointer

@freund17
Copy link
Author

@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

;)

@avetisk
Copy link
Contributor

avetisk commented Apr 20, 2018

@freund17 👍

@oliviertassinari oliviertassinari added the component: speed dial This is the name of the generic UI component, not the React module! label Apr 21, 2018
@simoami
Copy link
Contributor

simoami commented May 1, 2018

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'
    }
  }
}

@rooch84
Copy link

rooch84 commented May 9, 2018

Thanks @freund17, works for me too.

@oliviertassinari
Copy link
Member

I have updated the reproduction to the latest version: https://codesandbox.io/s/4248q9vm0w.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: speed dial This is the name of the generic UI component, not the React module! component: tooltip This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

8 participants