Skip to content

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

Closed
@Schweinepriester

Description

@Schweinepriester

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions