@@ -29,6 +29,13 @@ spec:css22;
29
29
text:width
30
30
type:dfn; text:line box
31
31
</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>
32
39
33
40
<h2 id=intro>
34
41
Introduction</h2>
@@ -76,7 +83,8 @@ Anchor Node Selection</h3>
76
83
77
84
Each <a>scrolling box</a> aims to select an <a>anchor node</a>
78
85
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> .
80
88
81
89
Note: If the user agent does not support the 'scroll-padding' property,
82
90
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>.
85
93
The anchor node is always a <a>descendant</a> of the <a>scrolling box</a> .
86
94
In some cases, a scrolling box may not select any anchor node.
87
95
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
+
88
116
<div algorithm>
89
117
The <dfn id="anchoring-algorithm">anchor node selection algorithm</dfn>
90
118
for a scrolling box |S| is as follows:
91
119
92
120
1. If |S| is associated with an element
93
121
whose computed value of the 'overflow-anchor' property is ''overflow-anchor/none'' ,
94
122
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|,
96
127
perform the <a>candidate examination algorithm</a> for |N| in |S|,
97
128
and terminate if it selects an anchor node.
129
+
98
130
</div>
99
131
100
132
<div algorithm>
0 commit comments