Skip to content

[css-overflow-5] Allow scroll to target unreachable scroll marker targets #11318

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

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
14 changes: 13 additions & 1 deletion css-overflow-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,25 @@ Selecting The Active Scroll Marker: the '':target-current'' pseudo-class</h4>
1. While |active| is a [=scroll container=] containing [=scroll target=] elements targeted by |group|:
1. Let <var>scroller</var> be |active|.
1. Let <var>targets</var> be the set of the [=scroll target=] elements whose nearest ancestor [=scroll container=] is |scroller|
and the [=scroll container=] elements which contain [=scroll target=] elements targeted by the [=scroll marker group=] whose nearest ancestor [=scroll container=] is |scroller|.
and the [=scroll container=] elements which contain [=scroll target=] elements targeted by the [=scroll marker group=] whose nearest ancestor [=scroll container=] is |scroller|.
1. Let <var>primary</var> be the primary scrolling axis, assumed to be the block direction of the container's writing-mode.
1. Let <var>secondary</var> be the scrolling axis perpendicular to primary.
1. Let <var>position</var> be the 'eventual scroll position' considering ongoing scrolling operations.
1. For each <var>axis</var> of |primary|, followed by |secondary|:
1. Let <var>scrollport size</var> be the client size of |scroller| in the dimension |axis|.
1. For each |target| in |targets|, <a>determine the scroll-into-view position</a> of |target| in |axis|, storing this as the associated |target position| of |target|.
1. Let <var>scroll size</var> be the length of the <a>scrollable overflow area</a> of the |scroller| in the dimension |axis|.
1. Let <var>scroll range</var> be <code>|scroll size| - |scrollport size|</code>.
1. If |scroll range| is greater than 0, redistribute unreachable target positions:
1. Let <var>distribute range</var> be <code>min(1/8 * |scrollport size|, |scroll range| / 2)</code>.
1. Let <var>before targets</var> be all |targets| whose associated |target position| is less than <code>|distribute range|</code>.
1. Let <var>minimum position</var> be the minimum |target position| of |before targets|.
1. Update the associated |target position| of each target in |before targets| to
<code>(|target position| - |minimum position|) / (|distribute range| - |minimum position|) * |distribute range|</code>.
1. Let <var>after targets</var> be all |targets| whose associated |target position| is greater than <code>|scroll range| - |distribute range|</code>.
1. Let <var>maximum position</var> be the maximum |target position| of |after targets|.
1. Update the associated |target position| of each target in |after targets| to
<code>(|target position| - (|scroll range| - |distribute range|)) / (|maximum position| - (|scroll range| - |distribute range|)) * |distribute range| + (|scroll range| - |distribute range|)</code>.
1. Let |selected position| be the largest |target position|
where |target position| is equal to or before |position| in the |axis|,
or whose nearest smaller |target position| < |position| - |scrollport size| / 2 and whose |target position| < |position| + |scrollport size| / 2.
Expand Down