Skip to content

Commit 396d0cf

Browse files
authored
[css-scroll-anchoring-1] Add priority candidates for scroll anchor selection w3c#5018 (w3c#5050)
* Added priority candidates * Fix atomic/non-atomic inline text * Updated formatting and focus link * Updated focused element text * Update html spec links for readability * Remove insertion caret from priority list
1 parent 318285d commit 396d0cf

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

css-scroll-anchoring-1/Overview.bs

+34-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ spec:css22;
2929
text:width
3030
type:dfn; text:line box
3131
</pre>
32+
<pre class="anchors">
33+
spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/;
34+
urlPrefix: interaction.html
35+
type: dfn;
36+
text:DOM anchor
37+
text:focused area of the document
38+
</pre>
3239

3340
<h2 id=intro>
3441
Introduction</h2>
@@ -76,7 +83,8 @@ Anchor Node Selection</h3>
7683

7784
Each <a>scrolling box</a> aims to select an <a>anchor node</a>
7885
that is deep in the DOM
79-
and close to the block start edge of its <a>optimal viewing region</a>.
86+
and either should be prioritized as an important DOM node or is close to the
87+
block start edge of its <a>optimal viewing region</a>.
8088

8189
Note: If the user agent does not support the 'scroll-padding' property,
8290
the optimal viewing region of the scrolling box is equivalent to its <a>content area</a>.
@@ -85,16 +93,40 @@ An anchor node can be any <a>box</a> except one for a non-<a>atomic inline</a>.
8593
The anchor node is always a <a>descendant</a> of the <a>scrolling box</a>.
8694
In some cases, a scrolling box may not select any anchor node.
8795

96+
An element |C| is a <dfn id="anchor-viable-candidate">viable candidate</dfn>
97+
for becoming a scroll anchor for a scrolling box |S| if it meets all of the
98+
following criteria:
99+
* |C| is an element that is not a non-<a>atomic inline</a>.
100+
* |C| is <a>partially visible</a> or <a>fully visible</a> in |S|
101+
* |C| is a descendant of |S|
102+
* |C| is not in an <a>excluded subtree</a>
103+
* None of the ancestors of |C| up to |S| are in an <a>excluded subtree</a>
104+
105+
Some elements are considered to be <dfn
106+
id="anchor-priority-candidates">priority candidates</dfn> for anchor selection:
107+
1. The [=DOM anchor=] of the [=focused area of the document=].
108+
2. An element containing the current active selected match of the
109+
find-in-page user-agent algorithm. If the match spans multiple elements, then
110+
consider only the first such element.
111+
112+
Note that if the <a>priority candidate</a> is a non-<a>atomic inline</a>
113+
element, then instead consider its nearest ancestor element that is not a
114+
non-atomic inline element as the priority candidate.
115+
88116
<div algorithm>
89117
The <dfn id="anchoring-algorithm">anchor node selection algorithm</dfn>
90118
for a scrolling box |S| is as follows:
91119

92120
1. If |S| is associated with an element
93121
whose computed value of the 'overflow-anchor' property is ''overflow-anchor/none'',
94122
then do not select an anchor node for |S|.
95-
2. Otherwise, for each DOM child |N| of the element or document associated with |S|,
123+
2. Otherwise, for each <a>priority candidate</a> |PC| in order specified,
124+
check if |PC| is a <a>viable candidate</a> in |S|. If so, select it as an
125+
anchor node and terminate.
126+
3. Otherwise, for each DOM child |N| of the element or document associated with |S|,
96127
perform the <a>candidate examination algorithm</a> for |N| in |S|,
97128
and terminate if it selects an anchor node.
129+
98130
</div>
99131

100132
<div algorithm>

0 commit comments

Comments
 (0)