Skip to content

[css-scroll-snap-2] Expose location of snap points to javascript #11732

@johannesodland

Description

@johannesodland

To make it possible to build custom behavior around scroll-snapping, the position of snap points should be exposed to javascript.

When extending scroll-snap functionality it is sometimes necessary to know the exact location of the snap-points. This is currently necessary when i.e. implementing scrolling to snap point or extending padding to ensure all snap-points are reachable.

Currently, it is possible to compute the location of the snap-points by getting the computed styles of the scroll container and target element, and measuring their dimensions.

With the change in #11165 this might become impossible, as the browser will distribute some amount of the initial and ending scroll to ensure that the scroll position of the unreachable snap points does not overlap.

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