[csswg-drafts] [css-scroll-snap] Clarify scrollbar arrow behavior? (#4712)

Schweinepriester has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-scroll-snap] Clarify scrollbar arrow behavior? ==
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](https://user-images.githubusercontent.com/2644614/73315983-f0dbf880-4231-11ea-9768-37dc7e6e92e5.gif)
([As video](https://giant.gfycat.com/ImpureGlisteningGalapagosdove.mp4))

Chrome:
![ice_video_20200129-010148](https://user-images.githubusercontent.com/2644614/73316468-364cf580-4233-11ea-8922-4e5f2fff725b.gif)
([As video](https://giant.gfycat.com/InfamousRadiantGull.mp4))

I'm wondering what the intended behavior is?

The spec seems to classify those arrows under [intended-direction](https://drafts.csswg.org/css-scroll-snap-1/#intended-direction)

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

plus a section from [Choosing Snap Positions](https://drafts.csswg.org/css-scroll-snap-1/#choosing)

> (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.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4712 using your GitHub account

Received on Wednesday, 29 January 2020 00:37:35 UTC