Re: [csswg-drafts] [selectors] Add :modal-dialog pseudo-class (#6965)

There's been several issues discussing it, but the most relevant one is #4645.

There's nothing *inherently* magical about the top layer. You can achieve identical effects *today* via the common strategy of putting elements as final direct children of `body` and abspos or fixposing them. The point of the top layer is just *convenience* - because we reparent the element's box, it avoids things like scrollable ancestor clips *automatically* so you can put the element where it's convenient rather than always making it a `body` child.

So *removing* things from the top layer similarly isn't a property of "being in the top layer", but rather "being a UA-provided feature, and thus not necessarily something the page author knows about". We don't want the `video` fullscreen button to mess up the entire page unless the author specifically handled exitting fullscreen; similarly with modals. If the UA provides, the UA should take away as well, for good user experience. But browsers don't have the ability to automatically dismiss home-brewed dialogs that are just abspos divs living at the end of `body`, because that's done entirely by the page author and it's their responsibility to control it and dismiss it.

-----

So, yes, we can't have a selector that means "element is in the top layer" *and* a property that puts elements in the top layer. But we definitely want the latter, because it's a useful convenience primitive that has no reason not to be exposed to authors. And we don't actually need the former; what we need is a pseudo-class for detecting when a *host-language specific element* is in a *host-language specific state* that, as a side-effect, puts it in the top layer, because that's a useful semantic detail of the element's current state; that's completely doable. When a dialog is modal, when a video is fullscreened, etc. are all potentially foldable into here if we think it's useful.

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


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

Received on Thursday, 20 January 2022 17:59:27 UTC