Re: [csswg-drafts] [selectors] Should :active apply to dialogs? (#7258)

Was thinking about introducing `:topmost` for this, but then came to realize that a `[popup]` launched from within that dialog could ruin things: `dialog:modal:topmost` would no longer select that topmost modal once other elements steal away the `:topmost` pseudo from the dialog.

Looking back at the selectors we currently have, I think we could solve this with the introduction of a `::top-layer` pseudo-element, so that we can query its (virtual) children, combined with [`:nth-last-child(|An+B| of S)`](https://drafts.csswg.org/selectors/#nth-last-child-pseudo)

```
:nth-last-child(1 of ::top-layer dialog) {
  // topmost modal dialog in the top-layer, yay!
}
```

It would require that `::top-layer` reports the child elements in the order in which they got added to it (instead of their actual DOM order)

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


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

Received on Thursday, 23 June 2022 18:27:07 UTC