valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

fix(tooltip): tooltip flickering when hover the mouse on the border on the tooltip position #3075

Closed CarlosTenorio closed 5 years ago

CarlosTenorio commented 6 years ago

Bug description or feature request:

Tooltip flickering when hover the mouse on the border on the tooltip position.

Plunker/StackBlitz that reproduces the issue:

The Bug is reproducible on tooltip examples of: https://valor-software.com/ngx-bootstrap/#/tooltip I'm working with Bootstap 3.3.7 but I only reproduce the bug on version 4

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 1.9.3

Angular: 4.2.5

Bootstrap: 3.3.7

Build system: Angular CLI, System.js, webpack, starter seed:

angular/cli : 1.2.0

IlyaSurmay commented 6 years ago

Can't reproduce this on both versions (used chrome and firefox).

CarlosTenorio commented 6 years ago

Chrome version: Versión 62.0.3202.94 (Build official) (64 bits) Video Bug: https://vimeo.com/243642568

IlyaSurmay commented 6 years ago

Thanks, I reproduced it too. Strange but the flickering is only happening for tooltip on left button

CarlosTenorio commented 6 years ago

If you zoom the page (125%) is possible reproduce when the tooltip is on top too.

valorkin commented 6 years ago

it's and edge case :D

zodrog commented 6 years ago

Same issue here on Chrome latest

danielordonez commented 6 years ago

Same here with the latest version of Chrome

danielordonez commented 6 years ago

I found that the issue is happening when the tooltip becomes visible because it overlaps the element by a bit and since the z-index of the tooltip is normally higher than the element that fires the tooltip your element hides behind it meaning that you're no longer hovering it so it hides the tooltip and it creates a hide and show loop thus giving you the flickering effect.

It has to do with the positioning that ngx-bootstrap gives to the tooltip, but you would have to move it left by 2 pixels to solve the issue, which wouldn't be the most convenient thing to do in most cases. This issue happens also to bootstrap itself, you can test it in the official bootstrap demo.

You can quickly solve this issue by setting the z-index of the element that fires the tooltip to 1071 or higher (tooltip's default is 1070)

alireza-saberi commented 6 years ago

I still have the flickering issue even after changing z-index to 1071 and above

rokdazone commented 6 years ago

Add "pointer-events: none;" to the tooltip css, problem solved!

.tooltip { pointer-events: none; }

alireza-saberi commented 6 years ago

@rokdazone this one works! thanks

jasonpberry commented 6 years ago

Thanks @rokdazone !!

kevduncan commented 6 years ago

Adding container="body" to the element with the tooltip solved this issue for me

fijea commented 6 years ago

@rokdazone Thanks!

suparnavg commented 6 years ago

What solved it for me was setting .bs-tooltip-left CSS to {top: -12px; left: -182px;} - that is the "stable" position of the tooltip

JoelParke commented 6 years ago

@suparnavg Thanks!

spernica commented 6 years ago

This solution works, but css of the tooltip element is broken (it was moved by few pixels to the right with my left tooltip). .tooltip { pointer-events: none; }

Much better is init all tooltips with container body in javascript. $('[data-toggle="tooltip"]').tooltip({ container: 'body' });

j3soon commented 6 years ago

For me is: .popover { pointer-events: none; }

boazrymland commented 6 years ago

Be advised: in at least my version of AngularJS Material, you'll need to use { pointer-events: none !important; }

since the rendered tooltip has 'style' attribute on it which will override simple usage recommended above.

skirankumar7 commented 6 years ago

.popover { pointer-events: none; } above makes cursor not to change 'cursor hand' type. how to handle it?

boazrymland commented 6 years ago

.popover {cursor: default; }

?

Domainv commented 5 years ago

fixed here #4660, soon will be merged

velrino commented 5 years ago

Stranger things!

I resolved this problem in the project I'm working on with:

.popover { pointer-events: none !important; }

simondi commented 5 years ago

.tooltip { pointer-events: none; } solves my problem.

MarijkeM commented 5 years ago

I've tried all of the above solutions but nothing works for me. Are there any other suggestions? I use angular 5.0.0 and bootstrap 4.0.0 beta

KimAlexander commented 5 years ago

+ 1

scottd98052 commented 5 years ago

Setting the container to 'body' was the fix for me.

Much better is init all tooltips with container body in javascript. $('[data-toggle="tooltip"]').tooltip({ container: 'body' });

Vl4t0m1c0 commented 5 years ago

Hello, I had similar problem, for me "top tooltip" was jumping 1px up and down nonstop only in chrome browser. My fix was changing padding in component to: .bs - tooltip - top, .bs - tooltip - auto[x - placement^="top"] { padding: 0.3rem 0; }

Code before: .bs - tooltip - top, .bs - tooltip - auto[x - placement^="top"] { padding: 0.4rem 0; }

onepoordeveloper commented 5 years ago

I was facing the same problem and found out that it was because of css transition on all elements * { transition: 0.1s; }

sanjmeh commented 5 years ago

I found that the issue is happening when the tooltip becomes visible because it overlaps the element by a bit and since the z-index of the tooltip is normally higher than the element that fires the tooltip your element hides behind it meaning that you're no longer hovering it so it hides the tooltip and it creates a hide and show loop thus giving you the flickering effect.

It has to do with the positioning that ngx-bootstrap gives to the tooltip, but you would have to move it left by 2 pixels to solve the issue, which wouldn't be the most convenient thing to do in most cases. This issue happens also to bootstrap itself, you can test it in the official bootstrap demo.

You can quickly solve this issue by setting the z-index of the element that fires the tooltip to 1071 or higher (tooltip's default is 1070)

This seems to be the root cause of my shiny hoverbox flickering too but I can't apply your suggestions on the R shiny code directly. Could someone direct me to a place where this is also explained for R shiny ggplot environment?

denuihason commented 5 years ago

Add "pointer-events: none;" to the tooltip css, problem solved!

.tooltip { pointer-events: none; }

It works well .... Thanks

NataD commented 5 years ago

I have the same issue, but none of the solutions mentioned in this post helps.

onepoordeveloper commented 5 years ago

I have the same issue, but none of the solutions mentioned in this post helps.

Check if there are some hover effects being applied on the target element. Remove if there are..

NataD commented 5 years ago

I have the same issue, but none of the solutions mentioned in this post helps.

Check if there are some hover effects being applied on the target element. Remove if there are..

Removing hover effects from the target element does not solve the issue.

MathewGrg commented 4 years ago

This worked for me. { pointer-events: none; }

kunalturankar commented 4 years ago

i just removed placement:"left" , this worked for me

kavyai commented 4 years ago

Add "pointer-events: none;" to the tooltip css, problem solved!

.tooltip { pointer-events: none; }

Above fix is not working for me because I have a link "click here "placed inside tooltip ,I'll not be able to click on the link if I'm using --pointer-events: none...

meera1002 commented 4 years ago

Add "pointer-events: none;" to the tooltip css, problem solved!

.tooltip { pointer-events: none; }

Thank you :+1:

btiller123 commented 1 month ago

To use google charts with angular we use a wrapper which is ng2-google-charts so we don't have access to the google charts css files. We are currently using Angular 17. The workaround that I found to resolve the tooltip flickering which I applied to my own css file is:

::ng-deep.google-visualization-tooltip { pointer-events: none; }