[csswg-drafts] [cssom-view-1] Differentiate programmatic directional scrolls from absolute scrolls (#12394)

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

== [cssom-view-1] Differentiate programmatic directional scrolls from absolute scrolls ==
The [cssom-view-1](https://drafts.csswg.org/cssom-view/) spec currently specifies both scrollTo and scrollBy as if they both invoke the scroll method with the left and top set accordingly. However, I think that we should differentiate these APIs as relative directional scrolls and absolute scrolls as far as they affect several other APIs. The legacy `scrollLeft` and `scrollTop` should probably be treated as absolute scrolls as that is usually what they are used for.

Absolute scrolls:
* If interrupting an ongoing scroll, use the specified offset exactly.
* Are treated as [intended end position scrolls](https://www.w3.org/TR/css-scroll-snap-1/#intended-end-position) by scroll snap: https://www.w3.org/TR/css-scroll-snap-1/#scroll-types
* Don't set the last scroll direction for state queries #6400

Relative / directional scrolls:
* If interrupting an ongoing scroll, add their relative offset to the interrupted scroll position. E.g. `scrollBy(0, 10)` scroll always scroll 10px down rather than potentially scrolling up if there was an ongoing fling scroll.
* Are treated as [intended direction and end position](https://www.w3.org/TR/css-scroll-snap-1/#intended-direction-and-end-position) by scroll snap: https://www.w3.org/TR/css-scroll-snap-1/#scroll-types
* Change the last scroll direction for state queries #6400

Proposed resolution:
Define a consistent distinction between absolute scrolls and relative scrolls that can be implemented and shared across these affected specs.
Absolute scrolls: scrollTo, scrollLeft, scrollTop, anchor fragment scrolls, scroll anchoring, find in page scrolls, scroll thumb dragging?
Relative scrolls: scrollBy, arrow key, page up/down, spacebar, home/end?, scrollbar track clicks, scrollbar buttons

Any other ways of scrolling we need to categorize?

@tabatkins 

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 24 June 2025 16:29:29 UTC