-
Notifications
You must be signed in to change notification settings - Fork 746
Description
See https://github.com/bokand/RenderingIndependentScrollOffsets for details.
Summary: window.scrollY
|Element.scrollTop
are spec'd as double but in practice they're only reported at physical pixel increments. That means on a DSF 2X screen, the values are in increments of 0.5.
The above behavior is a generalization, details are in my explainer but behavior varies across and within engines, depending on where the scrolls are coming from, whether pinch-zoom is involved.
One idea that's available in Chrome behind a flag (chrome://flags/#fractional-scroll-offsets) is to treat the scroll values on Element
and window
as independent values free to take on any double value, with pixel snapping occurring entirely as an artifact of the rendering process. This is similar to how the location of elements is reported using getBoundingClientRect