-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global Styles: Add scoping of feature level selectors for custom block style variations #61033
Global Styles: Add scoping of feature level selectors for custom block style variations #61033
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Guessing this one will need a PHP backport, so I've added the label. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test. I don't see any issues here, though I'm not particularly familiar with this part of the codebase, so if you want a second approval it might not be a bad idea.
Thanks for the reviews @talldan 🙇
I'm pretty comfortable with this one. The scoping of node selectors in this class was added separately to the selectors API but around the same time. This PR just makes it work as expected and correctly scope any custom selectors defined by the block via the selectors API. The underlying issue hasn't surfaced previously as the few use cases that would scope things never needed custom selectors to target inner block markup. That will change with the extended block style variations feature. |
Backport for the PHP changes here can be found in WordPress/wordpress-develop#6475 |
Related:
Note: The changes in this PR are being split out from #57908 to make that more manageable
What?
Ensures that feature-level selectors for block style variations are correctly scoped when generating a theme.json stylesheet.
Important: Currently, only block styles registered via block.json on core blocks are supported through theme.json. This means the supported blocks and their block styles don't currently leverage feature-level selectors. The issue this PR addresses would only surface once custom block style variations can be defined via theme.json in #57908.
Why?
To ensure that once custom block style variations being registered via theme.json are supported, the resulting CSS selectors are correct.
Testing Instructions
npm run test:unit:php:base -- --filter WP_Theme_JSON_Gutenberg_Test