-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
With the CSS specificity change in WordPress 6.6, most rules are now wrapped in :root :where(). However, pseudo-elements like ::before and ::after cannot be wrapped in :where().
This means theme.json like this:
{
"$schema": "https://schemas.wp.org/wp/6.6/theme.json",
"version": 3,
"styles": {
"elements": {
"h1": {
"css": "&::before { content: 'Foo' }"
}
}
}
}Produces:
:root :where(h1::before) {
content: 'Foo';
}Which is invalid CSS and causes the CSS rule to no longer apply.
Step-by-step reproduction instructions
- Install fresh WordPress.
- Add an entry for
core/headinginstyles.blocksintwentytwentyfour/theme.json:}, +"core/heading": { + "css": "&::before { content: 'Foo' }" +}, "core/image": {
- See the invalid inline CSS gets added to the webpage:
Compare this to the equivalent in 6.5.5:
:root :where(.wp-block-heading::before ){content: 'Foo'}
Which is valid CSS..wp-block-heading::before {content: 'Foo'}
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 6.6.1
- Twenty Twenty-Four 1.2
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended