@@ -16,25 +16,6 @@ Abstract: This allows content authors to hint that the <a>boundary default actio
1616Abstract : such as scroll chaining and overscroll, should not be triggered.
1717</pre>
1818
19- <pre class='anchors'>
20- urlPrefix: https://www.w3.org/TR/css-display-3/
21- type: dfn; text: containing block chain
22- url: https://drafts.csswg.org/css-overflow-3/#scroll-container
23- type: dfn; text: scroll container
24- type: dfn; text: scroll containers
25- url: https://drafts.csswg.org/cssom-view/#viewport
26- type: dfn; text: viewport
27- url: https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement
28- type: dfn; text: scrollingElement
29- url: https://www.w3.org/TR/uievents/#default-action
30- type: dfn; text: default action
31- type: dfn; text: default actions
32- url: https://dom.spec.whatwg.org/#dom-event-preventdefault
33- type: dfn; text: preventDefault
34- url: https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener
35- type: dfn; text: passive flag
36-
37- </pre>
3819
3920Introduction {#intro}
4021=====================
@@ -45,20 +26,20 @@ A content author does not necessarily want <a>scroll chaining</a> to occur for a
4526containers</a> . Some <a>scroll containers</a> may be part of a <a>containing block chain</a> but may
4627serve a different logical purpose in the document and may want to prevent scrolling from continuing
4728up the <a>scroll chain</a> . To achieve this, a content author will install event listeners without
48- the <a>passive flag</a> set and will use <a>preventDefault</a> when there is a risk that scroll
29+ the <a>passive flag</a> set and will use {{Event/preventDefault()}} when there is a risk that scroll
4930chaining will occur. This is detrimental for the following reasons:
5031
5132* The user agent may in the future introduce new input methods for scrolling that are not supported
5233 by the content author's event listeners.
5334* A non passive event listener will delay scrolling because the user agent will have to wait for the
54- result of the event listener to determine if <a>preventDefault</a> was called causing increased
35+ result of the event listener to determine if {{Event/preventDefault()}} was called causing increased
5536 scroll latency.
5637* When scrolling is performed near the edge of the <a>scroll boundary</a> , the <a>default action</a>
5738 may cause both scrolling to the edge of the <a>scroll container</a> and a <a>boundary default
58- action</a> . Calling <a>preventDefault</a> will not only cancel the <a>boundary default action</a>
39+ action</a> . Calling {{Event/preventDefault()}} will not only cancel the <a>boundary default action</a>
5940 but also the scroll to the edge of the <a>scrollport</a> .
6041* The <a>default action</a> for the event may also provide additional behavior that the author does
61- not want to cancel such as an overscroll affordance. <a>preventDefault</a> doesn't allow the
42+ not want to cancel such as an overscroll affordance. {{Event/preventDefault()}} doesn't allow the
6243 content author to cancel only some of the <a>default actions</a> such as scroll chaining.
6344
6445Thus, it is not possible for a content author to control <a>scroll chaining</a> and overscroll in a
@@ -222,6 +203,47 @@ these values will have no side effects for a compliant implementation.
222203
223204Note: Programmatic scrolling is clamped and can not trigger any <a>boundary default actions</a> .
224205
206+ Overscroll and Positioned Elements {#overscroll-positioned}
207+ ----------------------------------
208+
209+ This specification does not generally dictate what, if any,
210+ "overscroll" or similar actions
211+ might occur as a [=local boundary default action=] .
212+
213+ However, if a user agent <em> does</em> use "overscroll" behavior
214+ (that is, allowing a scrollable element
215+ to be scrolled slightly "past the end" of its scrollable area,
216+ usually with a "rubber-banding" effect after the scroll or drag is completed),
217+ then the following applies:
218+
219+ If an element uses [=fixed positioning=]
220+ and is positioned relative to the [=initial containing block=] ,
221+ or is a [=sticky positioned=] element
222+ which is currently stuck to the [=viewport=] ,
223+ then when the [=root scroller=] experiences "overscroll",
224+ that element <em> must not</em> overscroll with the rest of the document's content;
225+ it must instead remain positioned as if the scroller was at its minimum/maximum scroll position,
226+ whichever it will return to when the overscroll is finished.
227+
228+ Even tho this can visually shift the fixed/sticky element
229+ relative to other elements on the page,
230+ it must be treated purely as a visual effect,
231+ and not reported as an actual layout/position change
232+ to APIs such as {{Element/getBoundingClientRect()}} .
233+
234+ Note: This behavior is because fixpos and viewport-stuck stickypos elements
235+ are positioned relative to "the viewport",
236+ which is conceptually above the root scroller
237+ in the page hierarchy
238+ (effectively, it's the [=scroll container=]
239+ holding the root scroller).
240+ Thus, overscrolling the root scroller shouldn't have any effect on them,
241+ just like how an abspos
242+ that is a child of a scroller
243+ but whose abspos containing block is <em> above</em> the scroller
244+ isn't affected by the scroller doing anything at all,
245+ including overscroll.
246+
225247
226248Physical Longhands for 'overscroll-behavior' {#overscroll-behavior-longhands-physical}
227249---------------------------------------------------------------------------------------
0 commit comments