From ccebfb34fa01079736dd6a5a9791d8d95d3e882d Mon Sep 17 00:00:00 2001 From: Robert Flack Date: Tue, 3 Dec 2024 17:02:04 -0500 Subject: [PATCH] [css-overflow-5] Treat the last scroll target as active When a targeted scroll is performed, use that target to determine the active scroll marker. Fixes #10738. --- css-overflow-5/Overview.bs | 63 ++++++++++++++++++++++-------- css-scroll-anchoring-1/Overview.bs | 2 +- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/css-overflow-5/Overview.bs b/css-overflow-5/Overview.bs index 8c284c7cb77..e05ab940ab8 100644 --- a/css-overflow-5/Overview.bs +++ b/css-overflow-5/Overview.bs @@ -155,6 +155,28 @@ its content will be integrated into this specification, which will then replace it. Until then, this specification only contains additions and extensions to level 4. +

+Overflow Concepts and Terminology

+ +Issue: Copy [[css-overflow-3#overflow-concepts|Level 3 content]] when final. + +

Scrolling overflow

+ +The following is added to the concepts in scrolling overflow: + +Every [=scroll container=] maintains a current scroll target. +It is initially null, +and is reset to null after any scrolling operations in that [=scroll container=] +initiated by the user, +or any script initiated operations that do not have a target, +or when the target is removed from the document. +Scrolling operations in the [=scroll container=] with a target Element or PseudoElement, +set the [=current scroll target=] to that target Element or PseudoElement. + +Issue: Setting the current scroll target should be defined in how to scroll a target into view. + +Issue: Use the current scroll target as an anchor priority candidate for scroll anchoring. +

Scroll navigation controls

@@ -301,23 +323,30 @@ Selecting The Active Scroll Marker: the '':target-current'' pseudo-class 1. While |active| is a [=scroll container=] containing [=scroll target=] elements targeted by |group|: 1. Let scroller be |active|. 1. Let targets 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|. - 1. Let primary be the primary scrolling axis, assumed to be the block direction of the container's writing-mode. - 1. Let secondary be the scrolling axis perpendicular to primary. - 1. Let position be the 'eventual scroll position' considering ongoing scrolling operations. - 1. For each axis of |primary|, followed by |secondary|: - 1. Let scrollport size be the client size of |scroller| in the dimension |axis|. - 1. For each |target| in |targets|, determine the scroll-into-view position of |target| in |axis|, storing this as the associated |target position| of |target|. - 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. - - 1. : If there is no such position, - :: - Set the |selected position| to the first one. - - 1. Let |active| be the all of the |targets| whose associated |target position| is |selected position|. - 1. Let |active| be the first item in |active| if it has more than one potential target. + and the [=scroll container=] elements which contain [=scroll target=] elements targeted by the [=scroll marker group=] whose nearest ancestor [=scroll container=] is |scroller|. + 1. : If |scroller| has a non-null [=current scroll target=] + :: + Let active be the first item in |targets| encountered by a reverse tree order walk starting from the [=current scroll target=], + or the first item in tree order in |targets| if no target is found in the previous walk. + + : Otherwise, + :: + 1. Let primary be the primary scrolling axis, assumed to be the block direction of the container's writing-mode. + 1. Let secondary be the scrolling axis perpendicular to primary. + 1. Let position be the 'eventual scroll position' considering ongoing scrolling operations. + 1. For each axis of |primary|, followed by |secondary|: + 1. Let scrollport size be the client size of |scroller| in the dimension |axis|. + 1. For each |target| in |targets|, determine the scroll-into-view position of |target| in |axis|, storing this as the associated |target position| of |target|. + 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. + + 1. : If there is no such position, + :: + Set the |selected position| to the first one. + + 1. Let |active| be the all of the |targets| whose associated |target position| is |selected position|. + 1. Let |active| be the first item in |active| if it has more than one potential target. 1. Let |selected marker| be the [=scroll marker=] associated with |active|. If multiple [=scroll marker=] elements are associated with |active|, diff --git a/css-scroll-anchoring-1/Overview.bs b/css-scroll-anchoring-1/Overview.bs index fa9cad91f05..c21985b7587 100644 --- a/css-scroll-anchoring-1/Overview.bs +++ b/css-scroll-anchoring-1/Overview.bs @@ -119,7 +119,7 @@ following criteria: * |C| is not in an excluded subtree * None of the ancestors of |C| up to |S| are in an excluded subtree -Some elements are considered to be priority candidates for anchor selection: 1. The [=DOM anchor=] of the [=focused area of the document=], if such an anchor is text editable ([=editable=], [=editing host=], [=mutable=] <{textarea}>, or