Contact email
Spec
http://dev.w3.org/csswg/cssom-view/ (See sections 4, 5, 7, 12, and 13.)
Summary
This adds an optional ScrollOptions argument to CSSOM scrolling APIs; this additional argument allows specifying that a particular scroll should be performed smoothly rather than instantly. This also adds a scroll-behavior CSS property, which specifies whether scrolls performed on a scrolling box (via CSSOM scrolling APIs or via navigation) should be smooth or instant.
Motivation
Current scroll APIs only scroll instantly. In order to simulate a smooth scroll, web developers are forced to make a sequence of small changes to scrollTop or a sequence of calls to scroll APIs (e.g using rAF), with each call scrolling instantly by a small amount. As with all animation driven on the main thread, this can be janky. Smooth scrolls initiated using the new API can be driven on the compositor thread, and hence remain smooth even when the main thread is busy.
Compatibility Risk
Smooth scrolling was added to the CSSOM View spec in May [1]. Mozilla has expressed support for the idea of adding smooth scrolling to the spec [2].
Ongoing technical constraints
None.
Will this feature be supported on all five Blink platforms (Windows, Mac, Linux, Chrome OS and Android)?
Yes.
OWP launch tracking bug?
None yet.
Row on feature dashboard?
Yes.
Requesting approval to ship?
No.
[1] http://lists.w3.org/Archives/Public/www-style/2013May/0630.html
[2] http://lists.w3.org/Archives/Public/www-style/2013Mar/0314.html
Oh... reading the www-style thread, it looks like this only applies to
page-triggered scrolls (window.scrollTo, etc)? That's not so bad, I
retract my objection if this indeed does not apply to mousewheel/arrow
key scrolls.
Maybe change the behavior value to take either a keyword ("smooth", "instant", "auto") or a number (of milliseconds)?Perhaps align the state with the CSS animation timing function keywords (https://developer.mozilla.org/en-US/docs/Web/CSS/timing-function#Keywords_for_common_timing-functions) and add a duration key as well in ScrollOptions, which would be a number of milliseconds.