Skip to content

fix: avoid re-scoping nested selectors without &#1153

Merged
matthewp merged 1 commit into
mainfrom
css-nest-bug
Mar 16, 2026
Merged

fix: avoid re-scoping nested selectors without &#1153
matthewp merged 1 commit into
mainfrom
css-nest-bug

Conversation

@matthewp
Copy link
Copy Markdown
Contributor

@matthewp matthewp commented Mar 13, 2026

Changes

  • Avoid injecting Astro scope for nested selector rules that omit &.
  • Preserve expected output for cases like nav { a { ... } } (do not scope nested a).
  • Add/adjust ScopeStyle regression tests and include a patch changeset.
  • Fixes Scoped styles behave differently in Astro 6 astro#15907

Testing

  • go test ./internal/transform -run TestScopeStyle

Docs

  • Not needed (bug fix only).

Skip injecting Astro scope for nested selector rules that omit '&' so descendant selectors keep Astro 5 behavior, and add regression coverage plus a patch changeset.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: 733fe13

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

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler 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

@matthewp matthewp marked this pull request as ready for review March 13, 2026 19:45
@matthewp matthewp merged commit 05ef961 into main Mar 16, 2026
5 checks passed
@matthewp matthewp deleted the css-nest-bug branch March 16, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scoped styles behave differently in Astro 6

2 participants