Skip to content

[css-overflow-5] Selecting ::scroll-marker based on relationship to scroll target #11600

Open
@tabatkins

Description

@tabatkins

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:

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday Morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions