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

>  the "top layer" isn't really an implementation detail, is it?

I don't think it's a concept that speaks for starters/most people. Web devs know that a certain element is fullscreen, or a certain dialog is open/modal. Blog posts might explain that those things appear on top of all other elements, but without mentioning "top layer". Also, there is the confusion that we had on the WebKit team, on whether an element is a top layer, or is part of a set of elements called "the top layer". I think this pseudo class also has this ambiguity, e.g. `:modal` means this element is modal, so by the logic `:top-layer` means: this element is a top layer.

@mfreed7 I think the more important question here is: What use case does this solve for the Popup API? 

From what I can understand, we didn't go with something like `:popup-open`, in case a web developer wants to use a CSS transition to open the popup, where the closed state is not in the top layer, but the open state is. That design seems flawed to me, because I would expect the popup to be in the top layer while the transition is happening (regardless whether it is closing/opening), mainly because pushing/popping the top layer applies a couple of style adjustments, changes the stacking context, containing block, etc. which makes it inefficient to transition (and potentially could end up in broken results with the containing block changing during the transition).
So if the popup is closing, the popup should only be removed from the top layer when the transition for closing is done. If implemented this way, the `:top-layer` pseudo class would still match even though the popup is closing...

I generally think a `:top-layer` pseudo class should not exist, and instead the popup API use case should be addressed using something like `:popup-open`.








-- 
GitHub Notification of comment by nt1m
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7319#issuecomment-1144100767 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 20:26:18 UTC