W3C home > Mailing lists > Public > www-style@w3.org > October 2014

[cssom-view] scroll-behavior CSS property 'auto' value

From: Kip Gilbert <kgilbert@mozilla.com>
Date: Wed, 01 Oct 2014 11:34:03 -0700
Message-ID: <542C491B.2060303@mozilla.com>
To: www-style@w3.org
The CSSOM-View specification, section 14.1 (14.1 Smooth Scrolling: The
'scroll-behavior' Property), describes the 'scroll-behavior' CSS
property as allowing two values, 'instant' and 'smooth':

http://dev.w3.org/csswg/cssom-view/#smooth-scrolling:-the-%27scroll-behavior%27-property

The default value, 'instant', may be misleading as many scrolling
actions are animated smoothly by default in our implementation (and
others).  I propose that 'auto' be an allowed value, and be the default.

The value of 'smooth' would remain as defined in the CSSOM-View
specification; however, there would be some distinction between 'auto'
and 'instant'.  'auto' may result in a mixture of smooth and instant
scrolling animations, defined by existing UA behavior.  'instant' will
result in instant scrolling for all events.  If a UA does not scroll
smoothly by default for any events, 'auto' and 'instant' can be
synonymous in their implementation.

In our implementation, smooth scrolling occurs by default with
keyboard scrolling, with scroll-bar interaction, and to align the
scroll offset to snap points for CSS scroll snapping.
(http://dev.w3.org/csswg/css-snappoints/)

Section 14.1 (Smooth Scrolling: The 'scroll-behavior' Property) states:

"The 'scroll-behavior' property specifies the scrolling behavior for a
scrolling box, when scrolling happens due to navigation or CSSOM
scrolling APIs. Scrolls that are performed by the user are not
affected by this property."

This seems to exclude smooth scrolling due to keyboard
arrow/page/home/end buttons, mouse wheels, and scroll bar events which
would continue to scroll smoothly even with 'scroll-behavior: instant'
set.

When combined with CSS scroll snapping, the destination of these
smooth scroll animations is altered to ensure that the destination is
a valid snap point.  This is grey area in terms of being "performed by
the user"; if interpreted differently by each UA implementation, would
result in inconsistent results.

It is desirable in some circumstances for content to disable all
smooth scrolling, including scrolling that is not due to navigation or
CSSOM scrolling APIs.  One use case would be a spreadsheet
application.  In this case, it might be desirable to snap to a cell
boundary without the animation.

To enable content authors to explicitly disable all smooth scrolling
animation (including the scroll bar smooth scrolling and scroll
snapping animations), would the scroll-behavior CSS property be the
ideal interface for this?

Thanks,

- Kearwood "Kip" Gilbert
Received on Wednesday, 1 October 2014 18:34:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:47 UTC