bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

tooltip blinks when text is right-aligned

Open JulReb opened this issue 11 years ago • 7 comments

Hi, I have detected a regression on the tooltip functionnality since release 0.14.0. It was ok in release 0.13.4 (there was other problems on the tooltip which have been corrected). When the text under the tooltip is in a bootstrap column and the text is right-aligned, the tooltip comes over the text instead of being on top of it. If you don't move your cursor, the tooltip doesn't stop disappearing and reappearing.

Here is a plunker : http://plnkr.co/edit/FDtTvGj9FLmZV7IS4fCX?p=preview

And some screen captures :

v0 13 4

v0 14 0

I didn't see any other opened issue about this topic but sorry in advance if it's not the case, this is the first issue I submit and I'm not really used to github...

JulReb avatar Nov 10 '15 11:11 JulReb

The flicker is caused because the mouseenter/mouseleave events are firing as the mouse moves over the text rather than the span element. Not sure why this is happening...

RobJacobs avatar Nov 10 '15 13:11 RobJacobs

I understand that when the cursor comes over the text, the mouseenter event is fired, so the tooltip appears, but it is behind the cursor instead of being on top of it, so the cursor is considered not to be over the text anymore (as it is over the tooltip), so the mouseleave event fires and the tooltip disappears, so the cursor is over the text again and the mouseenter event is fired, etc... That probably explains the blinking.

So the real problem would be that the tooltip appears over the text instead of appearing on top of it...

JulReb avatar Nov 10 '15 15:11 JulReb

I would recommend using tooltip-append-to-body="true" in this case, working plunk

RobJacobs avatar Nov 10 '15 16:11 RobJacobs

This issue exists with the 0.13.4 release as this plunk demonstrates. I think this falls under the scenario:

When using floats, absolute positioning on the host element, append to body is recommended.

RobJacobs avatar Nov 12 '15 14:11 RobJacobs

With your plunk :

  • I cannot reproduce the issue, when the tooltip is displayed it appears correctly (I'm using Firefox 42.0)
  • but another problem appears, sometimes (around one time on five), the tooltip briefly appears in the middle of the page, then disappears and is correctly repositionned (maybe another issue which has already been corrected between 0.13.4 and 0.14.0?).

JulReb avatar Nov 12 '15 15:11 JulReb

The problem is the 'position: relative' style added to the container div with the col-xs-5 class. The positionElements function in the position service calls:

var hostElemPos = appendToBody ? this.offset(hostElem) : this.position(hostElem);

and since this is not append-to-body, it uses the logic in the position function which finds the closest positioned ancestor to determine what the host element 'top' value will be.

With the 'relative' position on the parent div:

Host element position:

{height: 16.100006103...", left: 186.51998901...", top: 1.9499816894...", width: 70.100006103..."}

Tooltip position:

{left: 168.06999206...", top: -31.05001831..."}

With the 'static' position on the parent div:

Host element position:

{height: 16.100006103...", left: 443.13998413...", top: 301.94998168...", width: 70.100006103..."}

Tooltip position:

{left: 424.68998718...", top: 268.94998168..."}

So I don't think the 'problem' is in the tooltip as it simply takes these numbers and applies them to the tooltip element.

RobJacobs avatar Nov 12 '15 20:11 RobJacobs

Closing as it appears to be a use issue (a bit unfortunately - wish this tooltip wasn't as complex).

wesleycho avatar Nov 22 '15 20:11 wesleycho