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

> I think the word `layer` should maybe be "reserved" only for things relating to cascade layers, as I believe this can cause confusion

I see the point - suggestions appreciated.



> `::backdrop` may match `::backdrop:top-layer`, but not `:top-layer` alone. Just like `:hover` can only select elements, even if `::before:hover` is valid according to the spec. You would need something like `**:top-layer` from #4565 in order to simultaneously select elements and pseudo-elements.

Right, I agree with this. I guess the confusing part might be if `::backdrop:not(:top-layer)` **matched** the `::backdrop` element. Because by [definition](https://fullscreen.spec.whatwg.org/#::backdrop-pseudo-element) `::backdrop` is in the top layer. Seems like it should therefore match `:top-layer`, right?



> While the Fullscreen spec. says that the `::backdrop` pseudo-element is in the same top layer as the originating element, from an author's perspective `::backdrop` is _behind_ its originating element.

Right. But as you point out, it **is in the top layer**. Seems like it would make sense to have it match `:top-layer` then.

-----

I'm not strongly against having `:top-layer` **not** match `::backdrop` from a use case point of view. I'm more arguing from a point of clarity about what it means to match `:top-layer`. Maybe there's a clean way to do that though. For the folks arguing against having `::backdrop` match `:top-layer`, how would you define `:top-layer`? My preferred definition is "matches anything in the [top layer](https://fullscreen.spec.whatwg.org/#top-layer)".

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


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

Received on Wednesday, 1 June 2022 18:25:05 UTC