Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
johannesodland opened this issue Feb 17, 2025 · 0 comments
Open

Comments

@johannesodland
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants