You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,22 @@
3
3
4
4
# Problem
5
5
6
-
Scroll chaining is the process of propagating the scroll to the the nearest scrollable parent element once a scrollable reaches its limit. Scroll chaining is not always desirable. For example consider a fixed/absolute position scroller whose scroll should not chain to parent scroller, i.e. the document. You can find this UX pattern used in most chat boxes that live at the bottom of the page such as in Facebook or Gmail UI.
6
+
Scroll chaining is the process of propagating the scroll event to the the nearest scrollable parent element once a scrollable reaches its limit. Scroll chaining is not always desirable. For example, consider a fixed/absolute position scroller whose scroll should not chain to the parent scroller, i.e. the document. You can find this UX pattern used in most chat boxes that live at the bottom of a page such as in Facebook or GMail UIs.
7
7
8
-
To give you a sense of how popular preventing scroll chaining may be, according to my quick http-archive search -ms-scroll-chaining: none is used in 0.4% of top 300K pages despite being limited in functionality and only supported on IE/Edge.
8
+
To give you a sense of how popular preventing scroll chaining may be, according to my quick http-archive search "-ms-scroll-chaining: none" is used in 0.4% of top 300K pages despite being limited in functionality and only supported on IE/Edge.
9
9
10
10
# Current Solution
11
11
12
-
-ms-scroll-chaining is a vendor specific API. The CSS property provides a simple declarative way to prevent propagation of scroll gestures to parent containers but unfortunately it is only limited to touch/touchpad scrolls.
12
+
-ms-scroll-chaining is a vendor specific API. The proposed CSS property provides a simple declarative way to prevent propagation of scroll gestures to parent containers but unfortunately it is limited to touch/touchpad scrolls only.
13
13
14
-
This means that currently the best cross-browser compatible way to prevent scroll propagation is to have a combination of blocking wheel event listener (bad for performance), blocking keyboard listeners for all scroll inducing keys, carefully crafted touch-action values, and perhaps even -ms-scroll-chaining. These are rather ugly and complex hacks that "-ms-scroll-chaining" should have been able to replace but it cannot in its current form.
14
+
This means that currently the best cross-browser compatible way to prevent scroll propagation is to have a combination of a blocking wheel event listener (bad for performance), blocking keyboard listeners for all scroll inducing keys, carefully crafted touch-action values, and perhaps even -ms-scroll-chaining. These are rather ugly and complex hacks that "-ms-scroll-chaining" should have been able to replace but it cannot in its current form.
15
15
16
16
# Proposal
17
17
18
18
The current proposal is a summary of the public discussion from:
19
19
https://github.com/w3c/csswg-drafts/issues/769
20
20
21
-
Introduce a new CSS property to control the scrolling behavior once a scrollable element reaches the boundary of the scrollport. This property will allow the author to hint that the user agent should deny scrolling from being chained to any ancestor. Note that for certain input modes, particularly on devices with a limited screen size and limited alternative input modes, the user agent may ignore the hint and allow scroll chaining to some ancestor, like the document viewport, or all ancestor.
21
+
This proposal introduces a new CSS property to control the scrolling behavior once a scrollable element reaches the boundary of the scrollport. This property will allow the author to hint that the user agent should deny scrolling from being chained to any ancestor. Note that for certain input modes, particularly on devices with a limited screen size and limited alternative input modes, the user agent may ignore the hint and allow scroll chaining to some ancestor, like the document viewport, or all ancestors.
22
22
23
23
The property can also hint at the overscroll behavior that the browser should take when at the boundary of the scrollport. The overscroll behavior is implementor defined. The property should provide a hint to either allow or disallow the overscroll behavior of the user agent.
24
24
@@ -29,15 +29,15 @@ scroll-boundary-behavior{-x,-y}: auto | contain | none
29
29
30
30
where:
31
31
* auto - Allow the default behavior for the user agent.
32
-
* contain - Hint to disable scroll chaining. The user agent may show an appropriate overscroll affordance. If the scroll chaining would trigger a non-scroll action, such as a navigation action, this property should be a hint to disable it.
32
+
* contain - Hint to disable scroll chaining. The user agent may show an appropriate overscroll affordance. If the scroll chaining would trigger a non-scroll action, such as a navigation action, this property should be a hint to disable the navigation action.
33
33
* none - Same as contain but also hint that no overscroll affordance should be triggered.
34
34
35
35
This should apply to all, non-programatic, user scroll actions.
36
36
37
37
# Issues to file
38
38
39
-
* Should the property disable scroll chaining through itself to an ancestor if scrolling is initiated from a children?
39
+
* Should the property disable scroll chaining through itself to an ancestor if scrolling is initiated from a child element?
40
40
41
41
* What if the property is attached to a potentially scrollable element without a scrollbox?
42
42
43
-
* What if the property is attached to a non-potentially scrollable element?
43
+
* What if the property is attached to an element which is not scrollable?
0 commit comments