Skip to content

Commit

Permalink
Issue w3c#4: Use 'scroll container' instead of 'scrollable element'
Browse files Browse the repository at this point in the history
Also make some small grammar fixes.
  • Loading branch information
bgirard committed May 5, 2017
1 parent 68a6a99 commit e349ced
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 40 deletions.
31 changes: 16 additions & 15 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@ Work Status: Exploring
Group: WICG
URL: https://wicg.github.io/scroll-boundary-behavior/
Editor: Benoit Girard, Facebook, [email protected]
Abstract: This module defines 'scroll-boundary-behavior' to control the behavior when a scroll position of a <a>potentially scrollable</a> element reaches the edge of the <a>scrollport</a>.
Abstract: This module defines 'scroll-boundary-behavior' to control the behavior when the scroll position of a <a>scroll container</a> reaches the edge of the <a>scrollport</a>.
Abstract: This allows content authors to hint that the <a>boundary default actions</a>,
Abstract: such as scroll chaining and overscroll, should not be triggered.
</pre>

<pre class='anchors'>
urlPrefix: https://www.w3.org/TR/css-display-3/
type: dfn; text: containing block chain
urlPrefix: https://www.w3.org/TR/cssom-view-1/
type: dfn; text: potentially scrollable
urlPrefix: https://www.w3.org/TR/uievents/
url: https://drafts.csswg.org/css-overflow-3/#scroll-container
type: dfn; text: scroll container
type: dfn; text: scroll containers
url: https://www.w3.org/TR/uievents/#default-action
type: dfn; text: default action
type: dfn; text: default actions
url: https://dom.spec.whatwg.org/#dom-event-preventdefault
type: dfn; text: preventDefault
url: https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener
type: dfn; text: passive flag
</pre>

Introduction {#intro}
=====================

<em>This section is not normative.</em>

A content author does not necessarily want <a>scroll chaining</a> to occur for all scrollable containers. Some scroll containers may be part of a <a>containing block chain</a> but may serve a different logical purpose in the document and may want to prevent scrolling from continuing up the <a>scroll chain</a>. To achieve this, a content author will install event listeners without the passive flag set and will use <a>preventDefault</a> when there is a risk that scroll chaining will occur. This is detrimental for the following reasons:
A content author does not necessarily want <a>scroll chaining</a> to occur for all <a>scroll containers</a>. Some <a>scroll containers</a> may be part of a <a>containing block chain</a> but may serve a different logical purpose in the document and may want to prevent scrolling from continuing up the <a>scroll chain</a>. To achieve this, a content author will install event listeners without the <a>passive flag</a> set and will use <a>preventDefault</a> when there is a risk that scroll chaining will occur. This is detrimental for the following reasons:
* The user agent may in the future introduce new input methods for scrolling that are not supported by the content author's event listeners.
* A non passive event listener will delay scrolling because the user agent will have to wait for the result of the event listener to determine if <a>preventDefault</a> was called causing increased scroll latency.
* When scrolling is performed near the edge of the <a>scroll boundary<a> the <a>default action</a> may cause both scrolling to the edge of the scrollable container and a <a>boundary default action</a>. Calling <a>preventDefault</a> will not only cancel the <a>boundary default action</a> but also the scroll to the edge of the <a>scrollport</a>.
* When scrolling is performed near the edge of the <a>scroll boundary<a>, the <a>default action</a> may cause both scrolling to the edge of the <a>scroll container</a> and a <a>boundary default action</a>. Calling <a>preventDefault</a> will not only cancel the <a>boundary default action</a> but also the scroll to the edge of the <a>scrollport</a>.
* The <a>default action</a> for the event may also provide additional behavior that the author does not want to cancel such as an overscroll affordance. <a>preventDefault</a> doesn't allow the content author to cancel only some of the <a>default actions</a> such as scroll chaining.

Thus, it is not possible for a content author to control <a>scroll chaining</a> and overscroll in a robust, performant and forward compatible way. The <a>scroll-boundary-behavior</a> property fixes this shortcoming.
Expand All @@ -47,33 +50,31 @@ Scroll chaining and boundary default actions {#scroll-chaining-and-boundary-defa

<em>Operating Systems have rules for scrolling such as scroll chaining and overscroll affordances. This specification does not mandate if and how scroll chaining or overscroll affordances be implemented. This specification only allows the content author to disable them if any are implemented.</em>

<dfn>Scroll chaining</dfn> is when scrolling is propagated from one scrollable container to an ancestor scrollable container following the <a>scroll chain</a>. Typically scroll chaining is performed starting at the event target recursing up the <a>containing block chain</a>. When a <a>potentially scrollable</a> element in this chain receives a scrollable event or gesture it may act on it and/or pass it up the chain. Chaining typically occurs when the <a>scrollport</a> has reached its boundary.
<dfn>Scroll chaining</dfn> is when scrolling is propagated from one <a>scroll container</a> to an ancestor <a>scroll container</a> following the <a>scroll chain</a>. Typically scroll chaining is performed starting at the event target recursing up the <a>containing block chain</a>. When a <a>scroll container</a> in this chain receives a scroll event or gesture it may act on it and/or pass it up the chain. Chaining typically occurs when the <a>scrollport</a> has reached its boundary.

A <dfn>scroll chain</dfn> is the order in which scrolling is propagated from one scrollable container to another.
A <dfn>scroll chain</dfn> is the order in which scrolling is propagated from one <a>scroll container</a> to another.

<dfn>Scroll boundary</dfn> refers to when the scroll position of a <a>potentially scrollable</a> element reaches the edge of the <a>scrollport<a>. In the non-scrollable case the element is always considered to be at the scroll boundary.
<dfn>Scroll boundary</dfn> refers to when the scroll position of a <a>scroll container</a> reaches the edge of the <a>scrollport<a>. If a scroll container has no potential to scroll, because it does not <a>overflow</a> in the direction of the scroll, the element is always considered to be at the scroll boundary.

<dfn>Boundary default action</dfn> refers to the user-agent-defined <a>default action</a> performed when scrolling against the edge of the <a>scrollport</a>. This may be scroll chaining, showing an overscroll affordance and/or performing a navigation action.

Issue(WICG/scroll-boundary-behavior#4): Should this specification apply to a scrollable element, potentially scrollable element or any element.

Overview {#overview}
==========================

This module introduces control over the behavior of a <a>potentially scrollable</a> element when its <a>scrollport</a> reaches the boundary of its scroll box. It allows the content author to specify that a <a>potentially scrollable</a> element must prevent scroll chaining and/or overscroll affordances.
This module introduces control over the behavior of a <a>scroll container</a> element when its <a>scrollport</a> reaches the boundary of its scroll box. It allows the content author to specify that a <a>scroll container</a> element must prevent scroll chaining and/or overscroll affordances.

Scroll Boundary Behavior Properties {#scroll-boundary-behavior-properties}
==========================

These properties specify how a <a>potentially scrollable</a> element must behave when scrolling. A element that is not <a>potentially scrollable</a> must accept but ignore the values of this property. This property must be applied to all input methods supported by the user agent.
These properties specify how a <a>scroll container</a> element must behave when scrolling. A element that is not <a>scroll container</a> must accept but ignore the values of this property. This property must be applied to all input methods supported by the user agent.

Note: This property should provide guarantees that are, at least, as strong as <a>preventDefault</a> for preventing both scroll chaining and overscroll. Doing otherwise would cause content authors to use <a>preventDefault</a> instead.

<pre class=propdef>
Name: scroll-boundary-behavior-x, scroll-boundary-behavior-y
Value: ''contain'' | ''none'' | ''auto''
Initial: ''auto''
Applies to: <a>potentially scrollable</a> elements
Applies to: <a>scroll container</a> elements
Inherited: no
Percentages: N/A
Media: visual
Expand All @@ -88,7 +89,7 @@ The 'scroll-boundary-behavior-x' property specifies the behavior of the 'scroll-
Name: scroll-boundary-behavior
Value: ''contain'' | ''none'' | ''auto''
Initial: ''auto''
Applies to: <a>potentially scrollable</a> elements
Applies to: <a>scroll container</a> elements
Inherited: no
Media: visual
Computed value: see individual properties
Expand Down
Loading

0 comments on commit e349ced

Please sign in to comment.