[csswg-drafts] [cssom-view] Clarify scroll-behavior: "auto" (#3497)

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

== [cssom-view]  Clarify scroll-behavior: "auto" ==
In the [smooth-scrolling section of the CSSOM-View spec draft](https://drafts.csswg.org/cssom-view/#smooth-scrolling), the following is written:

> `auto`
>    The scrolling box is scrolled in an instant fashion

However, as far as I can tell, this is misaligned with every browser implementation of the spec when using the imperative `Element.prototype.[scroll|scrollTo|scrollBy|scrollIntoView]` or `window.[scroll|scrollTo|scrollBy]` methods.

Instead, for `auto` values, the `scrollBehavior` property value that lives in the CSSOM will be used. If that is also `auto`, then yes, scrolling will happen in an instantaneous fashion, but if it is `smooth`, scrolling will be smooth, no matter which `ScrollBehavior` is provided.

See this Codepen for a simple illustration of this behavior: https://codepen.io/anon/pen/JwBpVa

From the polyfills I've surveyed, it looks like most of them are interpreting the spec text literally and they are opting out of smooth scrolling if they receive `ScrollOptions` with `behavior: "auto"`, not taking into account the `scrollBehavior` in the CSSOM.

This also means that based on current browser implementations, it is possible to smooth scroll an otherwise instantaneous scrolling box by giving an explicit `ScrollBehavior` to the `ScrollOptions` of the imperative scroll APIs, but _not_ possible to do the inverse: Instantaneously scroll an otherwise smooth scrolling box.

I think that it would be valuable to either:

1) Clarify this behavior in the spec, or
2) Introduce a third `ScrollBehavior` called `"instant"`

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

Received on Wednesday, 9 January 2019 09:10:22 UTC