Skip to content

fix(css/parser): correctly parse container query scroll-state#9254

Merged
ematipico merged 1 commit intomainfrom
fix/css-scroll-state
Feb 27, 2026
Merged

fix(css/parser): correctly parse container query scroll-state#9254
ematipico merged 1 commit intomainfrom
fix/css-scroll-state

Conversation

@ematipico
Copy link
Member

Summary

Closes #8842

With the help of an AI agent, it turns out the parser was at fault.

Test Plan

Added new tests

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: d82d74b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ematipico ematipico requested review from a team February 26, 2026 22:14
@github-actions github-actions bot added A-Parser Area: parser A-Formatter Area: formatter L-CSS Language: CSS labels Feb 26, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d0b8e6 and d82d74b.

⛔ Files ignored due to path filters (1)
  • crates/biome_css_formatter/tests/specs/css/atrule/container.css.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/fix-scroll-state-container-query.md
  • crates/biome_css_formatter/tests/specs/css/atrule/container.css
  • crates/biome_css_parser/src/syntax/at_rule/container/mod.rs

Walkthrough

This PR fixes a CSS formatter bug where @container scroll-state() queries were incorrectly formatted with unwanted spaces between the function name and opening parenthesis. The fix modifies the CSS parser to recognise scroll-state queries as a special case, preventing optional declarator names from being parsed when a scroll-state query is present. Supporting test cases verify the fix handles various scroll-state syntax variations.

Possibly related PRs

  • PR #8855: Also modifies container at-rule parsing and formatting to recognise and special-case scroll-state(...) syntax with shared test coverage.

Suggested labels

A-Parser, A-Formatter, L-CSS

Suggested reviewers

  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the core fix: correcting CSS parser handling of container query scroll-state syntax.
Description check ✅ Passed The description is related to the changeset, referencing issue #8842 and explaining that the parser was at fault with tests added.
Linked Issues check ✅ Passed The PR successfully addresses issue #8842 by fixing the parser to correctly handle scroll-state container queries and adding test coverage.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the CSS parser's scroll-state handling and adding relevant tests; no extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/css-scroll-state

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 26, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks
⏩ 187 skipped benchmarks1


Comparing fix/css-scroll-state (d82d74b) with main (2d0b8e6)

Open in CodSpeed

Footnotes

  1. 187 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Contributor

@denbezrukov denbezrukov left a comment

Choose a reason for hiding this comment

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

Hmm, that’s weird. Thanks for the fix!
I'll try to figure out what exactly caused it, since I haven't touched that code.

@ematipico ematipico merged commit f7bf12b into main Feb 27, 2026
17 checks passed
@ematipico ematipico deleted the fix/css-scroll-state branch February 27, 2026 08:58
@github-actions github-actions bot mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter A-Parser Area: parser L-CSS Language: CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📝 Formatter is breaking scroll-state container query

2 participants