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

flackr has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-overflow-5] Improve active marker calculation ==
Currently the active scroll marker is [determined by](https://drafts.csswg.org/css-overflow-5/#scroll-container-scroll) finding the target which is scrolled to or before the current scroll position. However, this means that even when the next section is 90%+ visible until it reaches the top of the scrollport (or it's scroll aligned position) the active marker does not update to this section. See https://flackr.github.io/carousel/examples/scroll-marker/scrolltarget/ for a demo of this behavior.

Instead, I propose we have the active marker calculated using logic similar to how snap areas are selected where we will select the next section if the previous target is above its desired scroll alignment and the next one is more than half-way to being aligned.

This could be analogous to snap areas where we create a virtual snap area from the start of one scroll target to the start of the next, however unlike snap areas we still want to strongly consider the previous if the next one is not yet sufficiently in view. E.g. if you're scrolled halfway through section 1 even though the target (the header) is scrolled above the viewport you should still be considered to be in section 1 until section 2 is mostly in view.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10917 using your GitHub account


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

Received on Wednesday, 18 September 2024 19:39:45 UTC