Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-scroll-snap-2] Resolve multiple scroll-start-targets by reverse DOM order #10929

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions css-scroll-snap-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -137,31 +137,32 @@ The 'scroll-start-target' property {#scroll-start-target}
<h4 dfn export id="initial-scroll-target">
Initial scroll target</h4>

The [=initial scroll target=] of a <a>scroll container</a> |scrollcontainer|
An [=initial scroll target=] of a <a>scroll container</a> |scrollcontainer|
is an element or pseudo-element
whose 'scroll-start-target'property is non-''scroll-start-target/none''
and whose nearest <a>scroll container</a> is |scrollcontainer|.
When multiple such elements or pseudo-elements exist,
user-agents should select the one
which comes first in [=tree order=].
When no such element or pseudo-element exists,
|scrollcontainer|’s <a>initial scroll target</a> is null.

<div algorithm="determine the initial scroll position from an initial scroll target">
If the <a>initial scroll target</a> of a <a>scroll container</a> is not null,
it should be used to determine the <a>initial scroll position</a> of |scrollcontainer|
by running the following steps:

1. Let |target| be the <a>initial scroll target</a> for |scrollcontainer|.
1. Let |position| be the result of running the steps to
<a spec="cssom-view-1">determine the scroll-into-view position</a> of |target|
with <var ignore>behavior</var> set to "auto",
<var ignore>block</var> set to "start",
<var ignore>inline</var> set to "nearest",
and <var ignore>scrolling box</var> set to |scrollcontainer|.
1. Set |scrollcontainer|'s <a>initial scroll position</a> to |position|.
</div>

and whose nearest <a>scroll container</a> is |scrollcontainer|. |scrollcontainer|
may have more than one <a>initial scroll target</a>.

<h5 dfn id="determine-scroll-start-target-position">Determining initial scroll position from
scroll-start-target</h5>
To determine the <a>initial scroll position</a> of a <a>scroll container</a> |scrollcontainer| using its
<a>initial scroll target</a>s, user-agents should run the following steps:

1. Let <dfn>initial-scroll-target-list</dfn> be a list of the <a>initial scroll target</a>s of |scrollcontainer|,
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>.
1. For |target| in <a>initial-scroll-target-list</a>:
1. Let |position| be the result of running the steps to
<a spec="cssom-view-1">determine the scroll-into-view position</a> of |target|
with <var ignore>behavior</var> set to "auto",
<var ignore>block</var> set to "start",
<var ignore>inline</var> set to "nearest",
and <var ignore>scrolling box</var> set to |scrollcontainer|.
1. Set |scrollcontainer|'s <a>initial scroll position</a> to |position|.

NOTE: Sorting <a>initial-scroll-target-list</a> 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>
is intended to prioritize having the first <a>initial scroll target</a> in tree order
scrolled into view.

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

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


<!-- Big Text: :snapped
Expand Down