Re: [csswg-drafts] [css-anchor-1] Ability to escape containment of other positioned elements (#8588)

Another thing that I found impossible to implement with anchor positioning, and for which an ability to escape the containment could be used — for replicating the behavior of the Popover API. The popovers from it can properly escape their context, regardless of any `position: relative` on them or maybe even some strict `contain`.

Anchored elements do not have this feature, as even `fixed` elements behave just like our good old fixed ones, making it _very_ easy to have a wrapper that would restrict what we could do with them, leading to the necessity to use JS to portal them to the end of the body manually.

For popovers-related things we could use the Popover API, however I'd argue that there could be a lot of potential usage for anchored decorations that would also need to be able to escape their containers in the same way.

I would also argue that _ideally_, we should design CSS & HTML in a way where any native HTML behavior that relates to layout, positioning and any visuals must be possible to re-create with CSS. Otherwise, for various cases, developers would be lead with two options: either using JS for presentational needs, or misuse the HTML API that provides the functionality they need (see all the logic on checkboxes, `:target` etc). And having an ability to re-create the new popovers behavior with just CSS is something that fits that idea.


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


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

Received on Tuesday, 21 March 2023 22:56:20 UTC