Skip to content

Commit 41e44c0

Browse files
committed
[css-overflow-5] Allow scroll to target unreachable scroll marker target positions.
This adds to the non-normative suggested algorithm for selecting the active scroll marker the proposed compromise in w3c#11165 to ensure that scrolling from start to end scrolls through all of the markers in that scroller.
1 parent 9a8ec95 commit 41e44c0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

css-overflow-5/Overview.bs

+13-1
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,25 @@ Selecting The Active Scroll Marker: the '':target-current'' pseudo-class</h4>
301301
1. While |active| is a [=scroll container=] containing [=scroll target=] elements targeted by |group|:
302302
1. Let <var>scroller</var> be |active|.
303303
1. Let <var>targets</var> be the set of the [=scroll target=] elements whose nearest ancestor [=scroll container=] is |scroller|
304-
and the [=scroll container=] elements which contain [=scroll target=] elements targeted by the [=scroll marker group=] whose nearest ancestor [=scroll container=] is |scroller|.
304+
and the [=scroll container=] elements which contain [=scroll target=] elements targeted by the [=scroll marker group=] whose nearest ancestor [=scroll container=] is |scroller|.
305305
1. Let <var>primary</var> be the primary scrolling axis, assumed to be the block direction of the container's writing-mode.
306306
1. Let <var>secondary</var> be the scrolling axis perpendicular to primary.
307307
1. Let <var>position</var> be the 'eventual scroll position' considering ongoing scrolling operations.
308308
1. For each <var>axis</var> of |primary|, followed by |secondary|:
309309
1. Let <var>scrollport size</var> be the client size of |scroller| in the dimension |axis|.
310310
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|.
311+
1. Let <var>scroll size</var> be the length of the <a>scrollable overflow area</a> of the |scroller| in the dimension |axis|.
312+
1. Let <var>scroll range</var> be <code>|scroll size| - |scrollport size|</code>.
313+
1. If |scroll range| is greater than 0, redistribute unreachable target positions:
314+
1. Let <var>distribute range</var> be <code>min(1/8 * |scrollport size|, |scroll range| / 2)</code>.
315+
1. Let <var>before targets</var> be all |targets| whose associated |target position| is less than <code>|distribute range|</code>.
316+
1. Let <var>minimum position</var> be the minimum |target position| of |before targets|.
317+
1. Update the associated |target position| of each target in |before targets| to
318+
<code>(|target position| - |minimum position|) / (|distribute range| - |minimum position|) * |distribute range|</code>.
319+
1. Let <var>after targets</var> be all |targets| whose associated |target position| is greater than <code>|scroll range| - |distribute range|</code>.
320+
1. Let <var>maximum position</var> be the maximum |target position| of |after targets|.
321+
1. Update the associated |target position| of each target in |after targets| to
322+
<code>(|target position| - (|scroll range| - |distribute range|)) / (|maximum position| - (|scroll range| - |distribute range|)) * |distribute range| + (|scroll range| - |distribute range|)</code>.
311323
1. Let |selected position| be the largest |target position|
312324
where |target position| is equal to or before |position| in the |axis|,
313325
or whose nearest smaller |target position| < |position| - |scrollport size| / 2 and whose |target position| < |position| + |scrollport size| / 2.

0 commit comments

Comments
 (0)