Intent to Implement: CSSOM View smooth scroll API

1,005 views
Skip to first unread message

Ali Juma

unread,
Aug 6, 2013, 3:02:40 PM8/6/13
to blin...@chromium.org

Contact email

aj...@chromium.org


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


Christian Biesinger

unread,
Aug 6, 2013, 7:13:43 PM8/6/13
to Ali Juma, blink-dev
Why is this the kind of behavior that should be under control of the
website, rather than the user? Personally I hate smooth scrolling, and
would not like it to proliferate :(

But I guess that feedback belongs to www-style...

-christian

Christian Biesinger

unread,
Aug 6, 2013, 7:19:32 PM8/6/13
to Ali Juma, blink-dev
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.

-christian

Ali Juma

unread,
Aug 6, 2013, 7:22:04 PM8/6/13
to Christian Biesinger, blink-dev
On Tue, Aug 6, 2013 at 7:19 PM, Christian Biesinger <cbies...@chromium.org> wrote:
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.

Correct. This change has no effect on user-initiated scrolls (e.g. scrolling using a mousewheel, arrow keys, or the scrollbar).

Tab Atkins Jr.

unread,
Aug 8, 2013, 8:13:40 PM8/8/13
to Ali Juma, blink-dev
LGTM!

~TJ

PhistucK

unread,
Aug 14, 2013, 7:18:59 AM8/14/13
to Tab Atkins Jr., Ali Juma, blink-dev
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.


PhistucK

Ali Juma

unread,
Aug 14, 2013, 9:22:51 AM8/14/13
to PhistucK, Tab Atkins Jr., blink-dev
On Wed, Aug 14, 2013 at 7:18 AM, PhistucK <phis...@gmail.com> wrote:
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.


Allowing web authors to specify the duration and timing function of a smooth scroll was discussed on www-style, but the conclusion was to omit this for now ([1], [2]).

PhistucK

unread,
Aug 14, 2013, 9:58:03 AM8/14/13
to Ali Juma, Tab Atkins Jr., blink-dev
Thank you!


PhistucK

PhistucK

unread,
Oct 28, 2014, 7:52:58 AM10/28/14
to Ali Juma, Tab Atkins Jr., blink-dev
Reply all
Reply to author
Forward
0 new messages