[css-overflow-5] Selecting ::scroll-marker based on relationship to scroll target · Issue #11600 · w3c/csswg-drafts (original) (raw)
Currently, the existence of ::scroll-marker-group
is dependent on the scroll container having a non-none
value for scroll-marker-group. <https://drafts.csswg.org/css-overflow-5/#scroll-marker-group-pseudo> Then
::scroll-markerexistence is dependent on its corresponding
::scroll-marker-group` existence (+ markup information defining the element as being a "scroll marker").
This prevents us from making ::scroll-marker
a ":has-allowed pseudo-element", since its existence is determined by style, and using :has(::scroll-marker)
would allow cyclic styling loops. This, unfortunately, means it seems hard to define examples like this:
Note that the scroll-markers before the :target-current one are solid white; the current and subsequent ones are partially transparent. @argyleink tried to achieve this with:
.carousel li:has(~ li::scroll-marker:target-current)::scroll-marker { opacity: 1; }
But it doesn't work because ::scroll-marker
isn't marked as being valid in :has()
.
So, question: can we make the existence of ::scroll-marker
(and perhaps ::scroll-marker-group
) unconditional, based just on the markup information? We'd change the wording so the box generation is dependent on styling as currently specified, but the pseudo-element would be treated as existing regardless, so we could make ::scroll-marker
a ":has-allowed pseudo-element", and Adam's code would work.