Skip to content

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Aug 22, 2025

Changes

This PR fixes a CSS scoping issue when a compound selector does not contain a type selector and all the subclass selectors are pseudo selectors (e.g. pseudo-classes and pseudo-elements).

To fix this issue, when hitting a pseudo selector for the first time in a compound selector, if there is no type selector, we check if all the subclass selectors are pseudo selectors (this check is only done once per compound selector). If so, we add the scope before the first pseudo selector.

Testing

I added tests matching all the test cases reported in the issue.

Docs

This is a bug fix only, so no docs were added or updated.

Copy link

changeset-bot bot commented Aug 22, 2025

🦋 Changeset detected

Latest commit: e30144a

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

@HiDeoo HiDeoo merged commit 1264286 into withastro:main Aug 28, 2025
5 checks passed
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 CSS miscompilation on pseudo-elements with only pseudo-classes

2 participants