-
Notifications
You must be signed in to change notification settings - Fork 641
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
[cssom-view] Clarify scroll-behavior: "auto" #3497
Comments
Um, I also run into this confusion. Sadly, I find this: #2146 says:
, which means the I also suggest that |
w3c/csswg-drafts#2146 removes "instant", but Chrome and Firefox don't follow it. A further issue for reopening it is: w3c/csswg-drafts#3497
I also think |
Imagine you're building a search application and you've implemented scrollTo as an action when changing pages, it should be instantly, try going from page 1 to page 2 on google.com, you'll see what I mean. Smooth scroll is just a game spoiler in such a use case. I'm in that situation and webpack refuses to compile my project, because 'instant' is not part of the spec. |
@JeroenAdam nowadays However,
|
In the smooth-scrolling section of the CSSOM-View spec draft, the following is written:
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]
orwindow.[scroll|scrollTo|scrollBy]
methods.Instead, for
auto
values, thescrollBehavior
property value that lives in the CSSOM will be used. If that is alsoauto
, then yes, scrolling will happen in an instantaneous fashion, but if it issmooth
, scrolling will be smooth, no matter whichScrollBehavior
is provided.See this Codepen for a simple illustration of this behavior across browsers: 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
withbehavior: "auto"
, not taking into account thescrollBehavior
in the CSSOM. This looks to me as an indication that the spec text needs some clarification.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 theScrollOptions
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:
ScrollBehavior
called"instant"
The text was updated successfully, but these errors were encountered: