Skip to content

FF149 @container query is optional#29300

Open
hamishwillee wants to merge 6 commits intomdn:mainfrom
hamishwillee:ff149_at_container_queryless
Open

FF149 @container query is optional#29300
hamishwillee wants to merge 6 commits intomdn:mainfrom
hamishwillee:ff149_at_container_queryless

Conversation

@hamishwillee
Copy link
Copy Markdown
Contributor

FF149 adds support for @container selections where the <container-query> part is optiona in https://bugzilla.mozilla.org/show_bug.cgi?id=2016474

This allows you to just select a container based on its name:

@container --name {}

This adds the subfeature. You can test this using https://wpt.live/css/css-conditional/container-queries/query-container-name.html

Note that I have set Chrome and Safari as false but you can tell it is coming because they pass the test on the latest versions but NOT on current versions I can access: https://wpt.fyi/results/css/css-conditional/container-queries/query-container-name.html?label=master&label=experimental&aligned

Related docs work can be tracked in mdn/content#43212

@github-actions github-actions bot added data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:m [PR only] 25-100 LoC changed labels Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@hamishwillee hamishwillee requested a review from caugner March 23, 2026 00:50
@hamishwillee
Copy link
Copy Markdown
Contributor Author

Thanks @caugner - I accepted all.

@frehner
Copy link
Copy Markdown

frehner commented Mar 24, 2026

Update: this was just released in Safari 26.4! https://webkit.org/blog/17862/webkit-features-for-safari-26-4/

},
"container_query_optional": {
"__compat": {
"description": "name-only container queries",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version of the description was consistent with prior art, see this GitHub search.

Suggested change
"description": "name-only container queries",
"description": "`<container-query>` is optional",

Copy link
Copy Markdown
Contributor Author

@hamishwillee hamishwillee Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caugner The easy option would be for me to just accept this and get it in. But discussions like #29217 (comment) imply that we should try to reflect the consequences of the change.

In this case the consequence of making container query optional is that you can now have a container query that just filters on the name. That is the reason for this change and the main impact.

If you disagree, then please accept your changes and merge. If you agree, please just merge.

}
}
},
"container_query_optional": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"container_query_optional": {
"container-query_optional": {

@hamishwillee hamishwillee force-pushed the ff149_at_container_queryless branch from 17a8d54 to 045a915 Compare March 31, 2026 05:24
"spec_url": "https://drafts.csswg.org/css-conditional-5/#typedef-container-condition",
"support": {
"chrome": {
"version_added": "preview",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is expected to be merged into Chrome 148
https://chromium-review.googlesource.com/c/chromium/src/+/7705690

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

Labels

data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:m [PR only] 25-100 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants