Skip to content

[css-contain] Is it possible to apply containment inside @container? #6177

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
mirisuzanne opened this issue Apr 2, 2021 · 2 comments
Closed

Comments

@mirisuzanne
Copy link
Contributor

Is this allowed, or does it lead to cyclic dependencies?

.parent, .child { contain: layout inline-size; }

@container (inline-size > 30em) {
  .child { contain: initial; }
  .grandchild { /* which container is queried? */ }  
}
@kizu
Copy link
Member

kizu commented Apr 3, 2021

If I understand things corrent, in your example, the grandchild should query the parent, as the child's containment is disabled, but there is a container above (parent) still matching the CQ which made the child to lose containment.

However, testing this in chrome canary — there seems to be a bug currently: https://codepen.io/kizu/pen/abpWLgz — when resizing the window after we reduce the size and then increase it, if there is a disabled containment on .child inside a CQ, then when we restore the width, the style is not applied properly.

Overall, I don't think there is a cyclic dependency, but it could probably be expensive to compute properly, given that the current implementation bugs there?

@lilles
Copy link
Member

lilles commented Jun 8, 2021

Don't think there should be any circularity there. Reported issue: https://crbug.com/1217568

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

3 participants