Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

scrollTop/scrollHeight rounding discrepancies breaks preventParentScroll when display scaling is set. #71

Open
Aaron-Pool opened this issue Jan 24, 2019 · 2 comments
Assignees

Comments

@Aaron-Pool
Copy link

The issue here is pretty straight forward, on monitors that have any display scaling set (which I do, and I think it's pretty common, in the era of hdpi monitors), scrollTop can return a decimal value (see here). scrollHeight and `clientHeight on the other hand, always round to an integer (see here and here).

This results in an error where scrollTop is less than scrollDist, even though the scrollbar has reached the bottom. This is breaking preventParentScroll for me.

It's a super easy fix, and I'd be fine to do a PR if you're accepting them. Thanks!

@DominikSerafin
Copy link
Owner

PR would be great @Aaron-Pool, thank you for reporting this

@Aaron-Pool
Copy link
Author

@DominikSerafin There Ya Go

@DominikSerafin DominikSerafin self-assigned this Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants