Skip to content

Conversation

@10xjs
Copy link
Contributor

@10xjs 10xjs commented Mar 21, 2018

(Depends on : #62)
Closes: #43

When the target is scrolled outside of the viewport and the tooltip is constrained to the edge of the window, Chrome's behavior of apparently debouncing window scroll events causes the tooltip position to shift around slightly as the user scrolls. This is a consequence of the absolute positioned tooltip being transformed to appear to be fixed to the viewport edge.

To fix this, we detect scenarios where the tooltip is constrained at the viewport edge and the bounds rect is the viewport. In such scenarios, the position property of the rendered element is changed from absolute to fixed, which results in a constant, non-janky style property while the page scroll changes.

Before:

before

After:

after

@10xjs 10xjs force-pushed the fix-scroll-jank branch from 5ca140e to 1f67cca Compare March 21, 2018 01:21
Copy link
Contributor

@izaakschroeder izaakschroeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple and effective! This looks like a good QOL improvement! (Pending the other PR of course).

@10xjs 10xjs force-pushed the fix-scroll-jank branch 2 times, most recently from 16cb813 to 0439a11 Compare March 21, 2018 21:13
When the target is scrolled outside of the viewport and the tooltip is constrained to the edge of the window, Chrome's behavior of apparently debouncing window scroll events causes the tooltip position to shift around slightly as the user scrolls. This is a consequence of the absolute positioned tooltip being transformed to appear to be fixed to the viewport edge.

To fix this, we detect scenarios where the tooltip is constrained at the viewport edge and the bounds rect is the viewport. In such scenarios, the `position` property of the rendered element is changed from `absolute` to `fixed`, which results in a constant, non-janky style property while the page scroll changes.
@10xjs 10xjs force-pushed the fix-scroll-jank branch from 0439a11 to 814e04d Compare March 21, 2018 21:54
@10xjs 10xjs merged commit 51c995e into master Mar 21, 2018
@10xjs 10xjs deleted the fix-scroll-jank branch March 21, 2018 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Janky behavior when constrained to screen edge in chrome

3 participants