Skip to content

Conversation

@ddbeck
Copy link
Contributor

@ddbeck ddbeck commented Nov 25, 2025

Summary

This adds feature entries for container queries for anchor positioning.

Test results and supporting details

I tried a couple of demos on this to confirm that it's actually shipping, but https://chromestatus.com/feature/5177580990496768 is where I got the version number.

Related issues

via web-platform-dx/web-features#3403 and web-platform-dx/web-features#3564

@github-actions github-actions bot added data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:l [PR only] 101-1000 LoC changed labels Nov 25, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

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

@caugner caugner self-requested a review December 5, 2025 09:12
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

First pass, LGTM overall, but a few comments.

"deprecated": false
}
},
"fallback": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we documenting this (behavioral?) subfeatures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not a behavioral subfeature. It's a named container query "feature" (in media/container queries terminology, not the BCD sense), as in @container anchored(fallback: <some-value>).

Right now there's only one feature to query against, but it's possible other container query features could exist (e.g., @container anchored(foo-bar: <some-value>) would get a foo-bar key as a peer to fallback).

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a suffix for clarity?

Suggested change
"fallback": {
"fallback_feature": {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also modeled this feature after a scroll-state() descendant. If we do something different for anchor positioning, I think we ought to do the same for scroll-state.

Comment on lines +39 to +42
"anchor_position_queries": {
"__compat": {
"description": "Anchor position queries (`anchored()`)",
"spec_url": "https://drafts.csswg.org/css-anchor-position-2/#anchored-container-queries",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"anchor_position_queries": {
"__compat": {
"description": "Anchor position queries (`anchored()`)",
"spec_url": "https://drafts.csswg.org/css-anchor-position-2/#anchored-container-queries",
"anchored_function": {
"__compat": {
"description": "`anchored()` function",
"spec_url": "https://drafts.csswg.org/css-anchor-position-2/#container-rule-anchored",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The spec change I agree with, but I'm reluctant to change the description and key name.

I modeled this feature after scroll-state() (see this compat table), where we describe the feature as "Scroll-state queries" and then nest the features for that query type under it. If we do something different for anchor positioning, I think we ought to do the same for scroll-state.

Also, I think "function" specifically is a risky term in this context. The spec text here is a bit loose (other specs use the phrase "functional notation" for at-rule syntax like this). I think it's mostly a convenience for the spec authors to call these functions. They kinda look like functions, but CSS "functions" as each is defined by its own grammar—there's no primitive function that specs reuse.

"deprecated": false
}
},
"fallback": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a suffix for clarity?

Suggested change
"fallback": {
"fallback_feature": {

Copy link
Contributor Author

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

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

Thanks for the review, @caugner! Accepted some of this, plus some commentary below.

Comment on lines +39 to +42
"anchor_position_queries": {
"__compat": {
"description": "Anchor position queries (`anchored()`)",
"spec_url": "https://drafts.csswg.org/css-anchor-position-2/#anchored-container-queries",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The spec change I agree with, but I'm reluctant to change the description and key name.

I modeled this feature after scroll-state() (see this compat table), where we describe the feature as "Scroll-state queries" and then nest the features for that query type under it. If we do something different for anchor positioning, I think we ought to do the same for scroll-state.

Also, I think "function" specifically is a risky term in this context. The spec text here is a bit loose (other specs use the phrase "functional notation" for at-rule syntax like this). I think it's mostly a convenience for the spec authors to call these functions. They kinda look like functions, but CSS "functions" as each is defined by its own grammar—there's no primitive function that specs reuse.

"deprecated": false
}
},
"fallback": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also modeled this feature after a scroll-state() descendant. If we do something different for anchor positioning, I think we ought to do the same for scroll-state.

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

LGTM, let's get this in.

@caugner caugner changed the title Add data for anchor position container queries Chrome 143 supports CSS Anchor Position Container Queries Dec 9, 2025
@caugner caugner merged commit 9a01c60 into mdn:main Dec 9, 2025
8 checks passed
@mdn-bot mdn-bot mentioned this pull request Dec 9, 2025
@ddbeck ddbeck deleted the anchor-position-container-queries branch December 11, 2025 18:39
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:l [PR only] 101-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants