Skip to content

[css-scroll-snap] Clarify scrollbar arrow behavior? #4712

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

Closed
Schweinepriester opened this issue Jan 29, 2020 · 3 comments
Closed

[css-scroll-snap] Clarify scrollbar arrow behavior? #4712

Schweinepriester opened this issue Jan 29, 2020 · 3 comments

Comments

@Schweinepriester
Copy link
Contributor

Spec: https://www.w3.org/TR/css-scroll-snap-1/ respectively https://drafts.csswg.org/css-scroll-snap-1/

Given http://snap.glitch.me/carousel-with-snap-stop.html, Firefox 72.0.2 and Chrome 79.0.3945.130 currently have different behavior when using the scrollbar arrows:

Firefox:
ice_video_20200129-004937
(As video)

Chrome:
ice_video_20200129-010148
(As video)

I'm wondering what the intended behavior is?

The spec seems to classify those arrows under intended-direction

pressing an arrow key on the keyboard (or equivalent operations on the scrollbar)

plus a section from Choosing Snap Positions

(This implies that a scroll with only an intended direction must always ignore the starting snap positions.)

leads me to believe the behavior of Firefox is more aligned to the spec and moving to the next snap point is the intended behavior.

Is this correct? Might it be useful to clarify this?

Chrome has an issue to change the behavior: https://bugs.chromium.org/p/chromium/issues/detail?id=944184

Apologies if this is trivial/has been resolved already (saw #1605 & #3752), but at any rate I'm hoping this issue will be findable with an explicit answer 0:-)


On a slightly related note, has an JavaScript API been discussed to scroll (to) scroll snap points instead of having to calculate the coordinate(s) and using e.g. scrollTo?
The arrows on top of the items at http://snap.glitch.me/carousel-with-snap-stop.html are implemented like this as well.
I'd really like a function like

element.scrollSnapPoint(1); // scroll one item in direction
element.scrollSnapPoint(-1); // scroll one item against direction
…

esp. for snap targets with different sizes.

@tabatkins
Copy link
Member

Is this correct? Might it be useful to clarify this?

Yes, it's correct. As for clarification, note that the Chrome patch you link to links to the spec edit that's already meant to clarify this. ^_^

I've pinged the Chrome bug to see if we can get this landed.

On a slightly related note, has an JavaScript API been discussed to scroll (to) scroll snap points instead of having to calculate the coordinate(s) and using e.g. scrollTo?

Yes, we intend to add something for this at some point. Just haven't gotten around to it.

@Schweinepriester
Copy link
Contributor Author

Alright, thank you very much! :)

@Schweinepriester
Copy link
Contributor Author

On a slightly related note, has an JavaScript API been discussed to scroll (to) scroll snap points instead of having to calculate the coordinate(s) and using e.g. scrollTo?

Yes, we intend to add something for this at some point. Just haven't gotten around to it.

To document this for myself, it's being worked on: https://github.com/argyleink/ScrollSnapExplainers/tree/main/js-scrollToOptions_Snap-Additions 🎉
(previous: https://github.com/argyleink/ScrollSnapExplainers/tree/main/js-snapTo())

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

No branches or pull requests

2 participants