Skip to content

[css-anchor-position-1] Allowing to explicitly define the containing block for inset-area #9662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kizu opened this issue Nov 30, 2023 · 3 comments

Comments

@kizu
Copy link
Member

kizu commented Nov 30, 2023

With the inset-area (https://drafts.csswg.org/css-anchor-position-1/#inset-area) starting to taking shape in the Chrome Canary as a prototype, I've started playing with what we have there now. It is still missing a few things for proper testing, but I think I already have one idea that might be interesting to think about: what if we will allow specifying an explicit “containing block” which is used for the 3×3 grid of inset-area?

With anchor() values for insets, we can use any anchors for calculations, but with inset-area we're limited to our anchor-default (which we can configure), and the containing block, which we cannot. But what if we could?

I think the main use case might be “escaping” an ancestor with position: relative, and choosing a different containing block instead (probably with some keyword to choose the viewport?). I can also imagine some curious interactions that can come up from using a containing block that is intersecting with our anchor element, or for cases when they're in entirely different places, especially when the fallbacks could get involved.

This might clash slightly with reparenting, but I think it might be worth it making a part of anchor positioning (probably just using some other anchor name for the containing block? Similar to how there is now specified fallback bounds which allow using another anchor for the fallback stuff https://drafts.csswg.org/css-anchor-position-1/#fallback-bounds)

@tabatkins
Copy link
Member

I think this isn't an anchor-pos issue at all, but rather a generic Position issue about selecting your containing block more explicitly, yeah?

@kizu
Copy link
Member Author

kizu commented Dec 1, 2023

Yeah, maybe. I wanted to add that this might be a case for more generic “reparenting”, but forgot to do so. And I saw how this might be similar to fallback bounds, which could also be potentially described as a way to just select the containing block in the end as well?

That said, that potential selection of a containing block can't come soon enough: it feels that it could solve so many problems!

@tabatkins
Copy link
Member

Closing as #9868 dupe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants