Re: [csswg-drafts] [css-overflow-5] Improve active marker calculation (#10917)

We need to balance for uses where scroll marker targets may be
* Small and thus should still be current even when next item may be less than half a scrollport from being aligned, or
* larger than the scrollport, and shouldn't eagerly switch to next item until their content is more than half offscreen, and/or
* aligned to other edges, where we shouldn't choose a marker that is not yet visible.

Proposal, when deciding whether we should select the next item, we do so when:
1. We are past the ideal alignment of the previous (current algorithm), and
2. The next marker target intersects the viewport, and
3. The distance from the previous item's aligned scroll position to the next item's aligned scroll position (capped to one scrollport to not eagerly choose the next item) is more than twice than the distance to the next item being aligned.

Note that we unfortunately cannot use the exact same logic as snap areas. Since the target may only be the header of the entire section, we should consider the effective target to be everything from the first target being aligned to the next target being aligned. We could consider re-using the snap logic using this virtual area.

-- 
GitHub Notification of comment by flackr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10917#issuecomment-2378401464 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 27 September 2024 04:58:47 UTC