You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-overflow-5/Overview.bs
+40-22
Original file line number
Diff line number
Diff line change
@@ -289,33 +289,51 @@ Selecting The Active Scroll Marker: the '':target-current'' pseudo-class</h4>
289
289
This 'eventual scroll position' is used to determine the active marker within each [=scroll marker group=].
290
290
Since markers themselves may represent just the start of the content (e.g. headers), we consider the active marker to be the first one which we are at or beyond the scroll position of.
291
291
292
-
<div algorithm="scroll tracking">
293
-
Whenever a [=scroll container=] is scrolled, or layout changes the scroll position, the user agent must run these steps to determine the active marker:
292
+
Whenever a [=scroll container=] participating in one or more [=scroll marker groups=] is scrolled, or layout changes the eventual scroll position,
293
+
the user agent should determine and update the active marker for each [=scroll marker group=]
294
+
based on the section of content most likely to be of interest given the target scroll position.
295
+
296
+
<div algorithm="scroll tracking" class=example>
297
+
Example algorithm to determine the active marker for a given scroll marker <var>group</var>.
298
+
299
+
1. Let |scroller| be the nearest common ancestor [=scroll container=] of all of the [=scroll marker=] elements in |group|.
300
+
1. Let |active| be scroller.
301
+
1. While |active| is a [=scroll container=] containing [=scroll target=] elements targeted by |group|:
302
+
1. Let <var>scroller</var> be |active|.
303
+
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|.
305
+
1. Let <var>primary</var> be the primary scrolling axis, assumed to be the block direction of the container's writing-mode.
306
+
1. Let <var>secondary</var> be the scrolling axis perpendicular to primary.
307
+
1. Let <var>position</var> be the 'eventual scroll position' considering ongoing scrolling operations.
308
+
1. For each <var>axis</var> of |primary|, followed by |secondary|:
309
+
1. Let <var>scrollport size</var> be the client size of |scroller| in the dimension |axis|.
310
+
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 |selected position| be the largest |target position|
312
+
where |target position| is equal to or before |position| in the |axis|,
1. Let <var>position</var> be the 'eventual scroll position' for the scrolling operation.
296
-
1. For each focusgroup <var>group</var> containing one or more [=scroll marker control=] elements whose [=scroll target=] is a descendant of [=scroll container=]:
319
+
1. Let |active| be the all of the |targets| whose associated |target position| is |selected position|.
320
+
1. Let |active| be the first item in |active| if it has more than one potential target.
297
321
298
-
1. Let <var>markers</var> be all of the [=scroll marker control=] elements which are a part of the [=scroll marker group=]for the [=scroll container=].
299
-
1. Let <var>targets</var> be the [=scroll target=]s of |markers|, associated with the item of |markers| they came from, and sorted in [=tree order=].
300
-
1. For each |target| in |targets|, <a>determine the scroll-into-view position</a> of |target|, storing this as the associated |target position| of |target|.
301
-
1. Let |selected target| be the largest-indexed item of |targets|
302
-
whose associated |target position| is equal to or before |position| in both the block and inline axises in the current writing mode direction of the [=scroll container=].
322
+
1. Let |selected marker| be the [=scroll marker=]associated with |active|.
323
+
If multiple [=scroll marker=] elements are associated with |active|,
324
+
set |selected marker| to be the marker that is earliest in tree order among them.
325
+
1. Return |selected marker|
326
+
</div>
303
327
304
-
Issue: When the next marker is closer to being aligned than the previous we should use the next marker, in a manner similar to mandatory snap point selection.
328
+
<div algorithm="update active marker">
329
+
Whenever the UA determines that a new marker is the <var>active marker</var> for a [=scroll marker group=]<var>group</var> it must run the following steps:
305
330
306
-
1. : If there is no such item,
331
+
1. Set the active state of |active marker| to true.
332
+
1. : If |active marker| was the <a href="https://open-ui.org/components/focusgroup.explainer/#last-focused-memory">last-focused element</a> of the |group|,
307
333
::
308
-
Set the active state of all |markers| in the |group| to false and return.
309
-
310
-
1. Let |selected marker| be the marker associated with |selected target|.
311
-
If multiple items of |markers| are associated with |selected target|,
312
-
set |selected marker| to be the marker that is earliest in tree order.
313
-
1. Set the active state of |selected marker| to true.
314
-
1. : If the active element was the <a href="https://open-ui.org/components/focusgroup.explainer/#last-focused-memory">last-focused element</a> of the |group|,
315
-
::
316
-
Focus |selected marker|
317
-
1. Set the <a href="https://open-ui.org/components/focusgroup.explainer/#last-focused-memory">last-focused element</a> of the |group| to |selected marker|.
318
-
1. Set the active state of all other |markers| in the |group| to false.
334
+
Focus |active marker|
335
+
1. Set the <a href="https://open-ui.org/components/focusgroup.explainer/#last-focused-memory">last-focused element</a> of the |group| to |active marker|.
336
+
1. Set the active state of all other [=scroll marker=] elements in |group| to false.
0 commit comments