Skip to content

[css-scroll-snap-1] Why does scroll-snap-align: both snap in each axis independently? #9519

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
flackr opened this issue Oct 24, 2023 · 2 comments
Labels
css-scroll-snap-1 Current Work

Comments

@flackr
Copy link
Contributor

flackr commented Oct 24, 2023

In the css-scroll-snap-1 spec section 4.1.1 it states that for the scroll-snap-axis both:

The scroll container snaps to snap positions in both of its axes independently (potentially snapping to different elements in each axis).

What's the use case for this? I would expect the common case is that the author would expects the UA to snap to both axes of that element if it snaps to that element. If an author wants to snap independently on different axes (e.g. for rows and columns of a table) they can specify snap alignment in a single axis.

Use cases where you'd for sure want alignment in both axes are any sort of 2d selection UI, e.g. a 2d panning map with multiple POI that snaps to a particular POI.

This in particular makes using the snapchanged / snapchanging apis in css-scroll-snap-2 more complicated if you do want to know which element is aligned in both axes.

@flackr flackr added the css-scroll-snap-1 Current Work label Oct 24, 2023
@flackr
Copy link
Contributor Author

flackr commented Oct 24, 2023

In fact, the description of the axis values even says that it affects "whether snap positions are evaluated independently per axis, or together as a 2D point." Is it not expected that both should be treated as a 2D point or was the intention to add another value for evaluating it as a 2d point?

@fantasai
Copy link
Collaborator

fantasai commented Nov 1, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-scroll-snap-1 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants