Skip to content
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

[css-contain] Container queries wrongly assume that all elements can be contained #7667

Closed
Loirooriol opened this issue Aug 31, 2022 · 2 comments

Comments

@Loirooriol
Copy link
Contributor

See https://drafts.csswg.org/css-contain-3/#container-type

While all elements accept style containment, layout containment requires all these conditions:

Size containment and inline-size containment, in addition to the requirements above, also need:

It makes no sense to establish a query container for container size queries if size containment has no effect on the element. Obvious circularity issues.

@andruud
Copy link
Member

andruud commented Sep 6, 2022

The intent was that an element with container-type:size/inline-size is always a query container, regardless of whether or not containment can apply on the element. However, any queries against a query container that "does not support" queries along the relevant axis results in "unknown". I prefer keeping it this way, since it makes it possible to answer the question "is this a query container" immediately after the style recalc of an element. If we involve layout box information, we can't answer that question until after layout-tree-building, which is annoying.

But "does not support" is a little vague, and we could minimally also link to https://drafts.csswg.org/css-contain-2/#size-containment-box explicitly.

@Loirooriol
Copy link
Contributor Author

Ah, thanks, I missed

If [...] the query container does not support container size queries on the relevant axes, then the result of evaluating the size feature is unknown.

That works too. But yeah, the conditions for supporting container size queries are not clear, filed #7702

@Loirooriol Loirooriol closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
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