Skip to content

Commit fce4efe

Browse files
author
David Awogbemila
committed
Resolve multiple scroll-start-targets by reverse DOM order
1 parent bb2b151 commit fce4efe

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

css-scroll-snap-2/Overview.bs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -137,31 +137,32 @@ The 'scroll-start-target' property {#scroll-start-target}
137137
<h4 dfn export id="initial-scroll-target">
138138
Initial scroll target</h4>
139139

140-
The [=initial scroll target=] of a <a>scroll container</a> |scrollcontainer|
140+
An [=initial scroll target=] of a <a>scroll container</a> |scrollcontainer|
141141
is an element or pseudo-element
142142
whose 'scroll-start-target'property is non-''scroll-start-target/none''
143-
and whose nearest <a>scroll container</a> is |scrollcontainer|.
144-
When multiple such elements or pseudo-elements exist,
145-
user-agents should select the one
146-
which comes first in [=tree order=].
147-
When no such element or pseudo-element exists,
148-
|scrollcontainer|’s <a>initial scroll target</a> is null.
149-
150-
<div algorithm="determine the initial scroll position from an initial scroll target">
151-
If the <a>initial scroll target</a> of a <a>scroll container</a> is not null,
152-
it should be used to determine the <a>initial scroll position</a> of |scrollcontainer|
153-
by running the following steps:
154-
155-
1. Let |target| be the <a>initial scroll target</a> for |scrollcontainer|.
156-
1. Let |position| be the result of running the steps to
157-
<a spec="cssom-view-1">determine the scroll-into-view position</a> of |target|
158-
with <var ignore>behavior</var> set to "auto",
159-
<var ignore>block</var> set to "start",
160-
<var ignore>inline</var> set to "nearest",
161-
and <var ignore>scrolling box</var> set to |scrollcontainer|.
162-
1. Set |scrollcontainer|'s <a>initial scroll position</a> to |position|.
163-
</div>
164-
143+
and whose nearest <a>scroll container</a> is |scrollcontainer|. |scrollcontainer|
144+
may have more than one <a>initial scroll target</a>.
145+
146+
<h5 dfn id="determine-scroll-start-target-position">Determining initial scroll position from
147+
scroll-start-target</h5>
148+
To determine the <a>initial scroll position</a> of a <a>scroll container</a> |scrollcontainer| using its
149+
<a>initial scroll target</a>s, user-agents should run the following steps:
150+
151+
1. Let <dfn>initial-scroll-target-list</dfn> be a list of the <a>initial scroll target</a>s of |scrollcontainer|,
152+
sorted in reverse <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-order" id="ref-for-concept-tree-order">tree order</a>.
153+
1. For |target| in <a>initial-scroll-target-list</a>:
154+
1. Let |position| be the result of running the steps to
155+
<a spec="cssom-view-1">determine the scroll-into-view position</a> of |target|
156+
with <var ignore>behavior</var> set to "auto",
157+
<var ignore>block</var> set to "start",
158+
<var ignore>inline</var> set to "nearest",
159+
and <var ignore>scrolling box</var> set to |scrollcontainer|.
160+
1. Set |scrollcontainer|'s <a>initial scroll position</a> to |position|.
161+
162+
NOTE: Sorting <a>initial-scroll-target-list</a> in reverse
163+
<a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-order" id="ref-for-concept-tree-order">tree order</a>
164+
is intended to prioritize having the first <a>initial scroll target</a> in tree order
165+
scrolled into view.
165166

166167
<h4 id="scroll-start-target-propdef">scroll-start-target Property Definition</h4>
167168

@@ -199,10 +200,9 @@ Post-first layout arrivals</h4>
199200
a <a>scroll container's</a> [=initial scroll target=] might arrive
200201
after that <a>scroll container</a> has been laid out.
201202
If this happens,
202-
user agents should still scroll to the [=initial scroll target=]
203-
unless the user agent has reason to believe
204-
the user is no longer interested
205-
in scrolling to the <a>initial scroll position</a>.
203+
user agents should still scroll to the <a>initial scroll position</a>
204+
<a href="determine-scroll-start-target-posision">determined</a> by 'scroll-start-target' unless the user agent has reason to believe
205+
the user is no longer interested in scrolling to the <a>initial scroll position</a>.
206206

207207

208208
<!-- Big Text: :snapped

0 commit comments

Comments
 (0)