sir-dunxalot / ember-tooltips

Easy and extendible tooltips for Ember components - http://sir-dunxalot.github.io/ember-tooltips/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tooltips getting into state where spacing becomes fixed in one direction

kstinson14 opened this issue · comments

Seen in version 3.1.1. It seems to be similar to #191.

Basically, a tooltip can get into a state where its spacing does not get adjusted when it flips to the opposite side of its target. Once this happens, it remains like that (spaced correctly when on one side of the target, and incorrectly when on the other side) until the page is reloaded.

It was tricky to find a super reliable repro case for this. It can be seen on the addon's demo page. It showed up fairly infrequently there when I'd activate / deactivate different tooltips on the page. But I was finally able to find a case that works pretty reliably:

  • Go to the addon demo page.
  • Scroll so that the div in the "With custom styling" section with the text "Show an error" is right at the top of your viewport.
  • Put your mouse over it to display the tooltip
  • Scroll up and down so that the tooltip keeps changes position from the top to the bottom of its target. Eventually you should see the tooltip lose its spacing from the target.
    tooltip-bug

Normally, this kind of behavior isn't really the normal use of someone looking at the tooltip, so by itself it seems like an edge case. But I'm running into this bug more frequently when I use this addon in my own application, with less wild scrolling. This was just the most dependable way to reproduce it.

I played around with a fork a bit and noticed the error is caused by the tooltip's _spacingRequestId always being non-null, causing setSpacing() to prematurely return and never update the margin-styling on the tooltip. That's why the margin is always correct when the tooltip is on one side of the target and not the other. As to what is causing that to be the case, however, I'm not sure. I'll update this if I gain more information.

Thanks for the sleuthing! I thought we had fixed this, but seems like not 😞