GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing drafts.csswg.org — CSS Scroll Anchoring Module Level 1 1. IntroductionToday, users of the web are often distracted by content moving around due to changes that occur outside the viewport. Examples include script inserting an iframe containing an ad, or non-sized images loading on a slow network. Historically the browser’s default behavior has been to preserve the absolute scroll position when such changes occur. This means that to avoid shifting content, the webpage can attempt to reserve space on the page for anything that will load later. In practice, few websites do this consistently. Scroll anchoring aims to minimize surprising content shifts. It does this by adjusting the scroll position to compensate for the changes outside the viewport. The explainer document gives an informal overview of scroll anchoring. 1.1. Value DefinitionsThis specification follows the CSS property definition conventions from [CSS2] using the value definition syntax from [CSS-VALUES-3]. Value types not defined in this specification are defined in CSS Values & Units [CSS-VALUES-3]. Combination with other CSS modules may expand the definitions of these value types. In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the CSS-wide keywords as their property value. For readability they have not been repeated explicitly. 2. DescriptionScroll anchoring attempts to keep the user’s view of the document stable across layout changes. It works by selecting a DOM node (the anchor node) whose movement is used to determine adjustments to the scroll position. However, if the scroll container is currently snapped to an element, (see [CSS-SCROLL-SNAP-1]) scroll anchoring is limited to adjustments that would be allowed by re-snapping. 2.1. Anchor Node SelectionEach scrolling box aims to select an anchor node that is deep in the DOM and either should be prioritized as an important DOM node or is close to the block start edge of its optimal viewing region. Note: If the user agent does not support the scroll-padding property, the optimal viewing region of the scrolling box is equivalent to its content area. An anchor node can be any box except one for a non-atomic inline. The anchor node is always a descendant of the scrolling box. In some cases, a scrolling box may not select any anchor node. An element C is a viable candidate for becoming a scroll anchor for a scrolling box S if it meets all of the following criteria:
Some elements are considered to be anchor priority candidates for anchor selection:
Note that if the priority candidate is a non-atomic inline element, then instead consider its nearest ancestor element that is not a non-atomic inline element as the priority candidate.
The anchor node selection algorithm
for a scrolling box S is as follows:
The candidate examination algorithm
for a candidate DOM node N in a scrolling box S is as follows:
A DOM node N is an excluded subtree
if it is an element and any of the following conditions holds:
A DOM node N is fully visible in a scrolling box S
if N’s scroll anchoring bounding rect is entirely within the optimal viewing region of S.
A DOM node N is fully clipped in a scrolling box S
if N’s scroll anchoring bounding rect is entirely outside the optimal viewing region of S.
A DOM node N is partially visible in a scrolling box S
if N is neither fully visible in S nor fully clipped in S.
The scroll anchoring bounding rect of a DOM node N
is N’s scrollable overflow rectangle.
2.1.1. InvalidationAn anchor node is considered valid for a scrolling box until any of the following occur:
Once an anchor node has become invalid, the anchor node selection algorithm must be run again to compute the anchor node As a performance optimization, implementations may wait until the anchor node is needed before computing it. 2.2. Scroll AdjustmentIf an anchor node was selected,
then when the anchor node moves,
the browser computes the previous offset It then queues an adjustment to the scroll position of The scroll adjustment is a type of scrolling as defined by [CSSOM-VIEW], and generates scroll events in the manner described there. 2.2.1. Suppression WindowEvery movement of an anchor node occurs within a window of time called the suppression window, defined as follows:
Note: The suppression window boundaries should be incorporated into the HTML standard once the scroll anchoring API is stabilized. More than one anchor node movement may occur within the same suppression window. At the end of a suppression window, the user agent performs all scroll adjustments that were queued during the window and not suppressed by any suppression trigger during the window. 2.2.2. Suppression TriggersA suppression trigger is an operation that suppresses the scroll anchoring adjustment for an anchor node movement, if it occurs within the suppression window for that movement. These triggers are:
Note: Suppression triggers exist for compatibility with existing web content that has negative interactions with scroll anchoring due to shifting content in scroll event handlers. 3. Exclusion APIScroll anchoring aims to be the default mode of behavior when launched, so that users benefit from it even on legacy content. overflow-anchor can disable scroll anchoring in part or all of a webpage (opt out), or exclude portions of the DOM from the anchor node selection algorithm.
Values are defined as follows:
Note: It is not possible to turn scroll anchoring "back on" for descendants of a overflow-anchor: none element. However, descendant scroll containers automatically "turn it back on" (for their own scrolling box) unless they explicitly have overflow-anchor: none set on them as well. Note: The Privacy ConsiderationsThis specification, as it only adjusts how we compute scroll positions, introduces no new privacy considerations. Security ConsiderationsThis specification, as it only adjusts how we compute scroll positions, introduces no new security considerations. ChangesChanges Since the Feb 11 2020 Working Draft
| ||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |