-
Notifications
You must be signed in to change notification settings - Fork 138
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
Powertip offset when browser scrollbar appears after load #176
Comments
It may actually be a non-trivial project to support the document or viewport changing size. Root causeWhat is happening here is that you are using the Since PowerTip loads the window dimensions into a cache variable on initialization, the math used to calculate where to place a tooltip will use values that are incorrect after the viewport changed size for the addition of the scroll bar. PowerTip does track window resizing via the Possible fixes that can be implemented in the plugin
Possible workaround for the current versionOther than what you are doing now, you should also be able to force PowerTip to refresh the cached window dimensions by triggering the window Where to go with this requestI'll consider the possible fixes. If you, or anyone reading this, can think of better alternative ways to fix this then please let me know. If I can verify that fetching viewport dimensions from the DOM doesn't add significant performance impact then it would be worth making that change. |
Thanks for the detailed reply! Interesting that appearance of the scrollbar does not trigger a window resize event - I wasn't aware of that. I found a hacky workaround to detect viewport resize but I doubt you'd want to go there with Powertip. For my case I'm fine with your suggestion of manually triggering a resize event, but for other users (or for cases where content is revealed via CSS only) maybe fix 2 is the way to go if the performance impact is not great. |
There seems to be a bug where powertips are offset by the width of the browser scrollbar if Powertip is initialised when no scrollbar is visible but the scrollbar is visible when the tooltips are shown (e.g. due to some content being added or revealed after DOM ready that necessitates the scrollbar).
In the screenshots below Powertip is initialised on DOM ready before the scrollbar is visible. This is Chrome v70.0.3538.102 in Windows.
Incorrect position:

Correct position (by forcing browser scrollbar to be visible on DOM ready via overflow:scroll on body)

I'm working around this by initialising Powertip after the content (and scrollbar) is visible but it would be good if Powertip handled this.
The text was updated successfully, but these errors were encountered: