Open bfgeek opened 4 months ago
I also would love to make this distinction, and prefer option 2. It seems like something we would have to do with some urgency to avoid compat issues?
Yeah it's somewhat urgent to make this change - I'll Adgenda+ think to gauge the temperature on this.
The CSS Working Group just discussed Containment
, and agreed to the following:
RESOLVED: container-type does not force layout containment, but does force an independent formatting context
Layout containment was originally added as a performance optimization for engines. To ensure that a layout inside an element wont affect the layout outside (more or less).
With container queries we split it out into layout+size containment so that we can target one dimension, e.g. layout+inline-size containment. This was good! But IMO it didn't go far enough.
Ideally we should have done weak-layout+inline-size (and there may be still time left to do this).
With container-queries (due to this) we have limited ourselves in a number of ways - e.g.
And we are breaking the layout containment optimization via allowing anchors to escape layout contained subtree, e.g. https://github.com/w3c/csswg-drafts/issues/10040 with this resolution we've allowed the layout inside of a contain:layout element to affect things outside.
For container queries the only "layout" containment we really need is that it establishes a new formatting context. (I've quickly checked https://chromium-review.googlesource.com/c/chromium/src/+/5685175 ).
There are a few of potential paths.
container-type
to ensure a new type of "weak-layout" containment (just establishing the new formatting context rule).container-type
not to enforce layout containment, (just size containment) and specify thatcontainer-type
establishes a new formatting context. (In an ideal world my preferred option).container-type
to allow this less strict version. e.g.container-type: new-inline-size
With all 3 of these we should undo - the anchor-pos resolution in https://github.com/w3c/csswg-drafts/issues/10040 and make layout containment contain anchors again.