E478 [cssom-view] What precision should scroll values be reported in? · Issue #4717 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[cssom-view] What precision should scroll values be reported in? #4717

@bokand

Description

@bokand

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0