Re: [csswg-drafts] [selectors] Add `:top-layer` pseudo class (#7319)

> `:top-layer` is like `*:top-layer` where `*` matches elements, not pseudo-elements like `::backdrop`. Do you mean `::backdrop:top-layer` should match? But that's strange, because pseudo-elements can only be followed by user action pseudo-classes (https://drafts.csswg.org/selectors/#pseudo-element-states) and it seems pointless since `::backdrop` only generates boxes if the originating element is in the top layer.

Sounds like there's generally some pushback to having this apply to `::backdrop` pseudo elements, and I can see those points. I agree there's likely not much of a use case, since `::backdrop` is always in the top layer. But is there any downside to making `::backdrop` match `:top-layer`, to make it easier to explain? I.e. "anything in the top layer", rather than "anything in the top layer, except for `::backdrop` pseudo elements, which are in the top layer but still don't match `:top-layer`"?

> I don't like the name `:top-layer` because the top layer is an implementation detail. Developers should not know about such detail. A semantic name would be more appropriate.

Suggestions appreciated. Note that in OpenUI, we discussed this multiple times, and there were [several suggestions](https://github.com/openui/open-ui/issues/470#issuecomment-1118020719), of which `:top-layer` won the vote. If there's a better name suggestion, let's discuss. One question though - the "top layer" isn't really an implementation detail, is it? To use it, developers need to know how it works, and it is [fairly well specified](https://fullscreen.spec.whatwg.org/#top-layer).

> `:top-layer` is also confusingly named as there can apparently be multiple 'top-layer's. Sometimes you need to know if an element is in a top-layer vs the top-most top-layer.

Yeah, I do think the **multiple**-top-layer thing is confusing in general. The "top-top-layer", which seems to be *just* for Shared Element Transitions, should likely get another name and another description. On the other hand, "top layer" is a [spec-defined concept](https://fullscreen.spec.whatwg.org/#top-layer) and this proposed pseudo class should be tied directly to that definition. Again, name suggestions appreciated.

Side question: what's the use case for "needing to know if an element is in the top-layer vs. the top-most top-layer"?

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


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

Received on Tuesday, 31 May 2022 17:22:52 UTC