-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Reduce specificity of block style variation selectors. #57659
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/class-wp-theme-json-gutenberg.php |
Size Change: +1 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
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 putting this together @tellthemachines 👍
The code changes here LGTM. As you noted on the PR, there appear to be a few pre-existing issues for block style variations.
I'm encountering problems with the Image Rounded variation: setting border-radius and duotone on the variation in global styles isn't working at all. It's broken on trunk too so not a problem specific to this PR.
Setting the border radius for an image worked for me but the duotone did not. I wonder if this is related to how duotone support tries to determine which filters are used on a page before adding all their styles?
Block spacing isn't working within the Quote Plain variation, or within the Social Icons variations. Again it's an issue on trunk: the styles aren't being output at all.
I'm not super familiar with block gap support but it appears that the processing of theme.json doesn't take into account block style variations here at all. So much like the elements, it's missing functionality.
Letter case and spacing are output with correct specificity on Tag Cloud but changes don't show in the editor (front end looks fine)
This worked in the editor for me in my testing.
I was primarily testing within TT3 but once I switched to TT4 I still got the same behaviours and same issues.
These should probably be investigated separately.
Agreed. If issues for them can be created, I'd happily pick a few up once the extended block style variation feature lands.
TT3 | TT4 |
---|---|
I'm inclined to approve this as is and follow up on the noted issues separately. It might still be good to get some further testing from fresh eyes though cc/ @andrewserong in case you have time.
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.
This is testing nicely for me, too! I used the following blocks (I think that's all of them for core?):
- Button
- Image
- Quote
- Separator
- Site Logo
- Social Icons
- Table
- Tag Cloud
The only issue I ran into that hasn't already been mentioned is that the Table block includes margin styles that are too specific and override the base layout rules, here:
margin: 0; |
Editor | Site frontend |
---|---|
I think that should likely be wrapped in a :where()
for consistency with other blocks / the layout block support. In any case, not a blocker here, and I'll open up a quick PR for it 🙂
All the other issues sound like good ones for follow-ups / to be looked into separate from this PR to me.
LGTM! ✨
Thanks for reviewing and testing folks! |
Noting this comment when it comes to backporting this one. |
✅ I updated this PR with the |
What?
Fixes #49835 (and tries to mitigate issues encountered in #56540)
Testing Instructions
I've tested pretty extensively with all core block style variations and all still seems to work as expected. The only core styles that needed a slight specificity reduction were Button Outline ones.
I did encounter a bunch of existing bugs that are reproducible on trunk:
Element styles (e.g. link and heading colors) aren't working within block style variations. This is a known issue, solved in Theme.json: Extend block style variations support #56540.
I'm encountering problems with the Image Rounded variation: setting border-radius and duotone on the variation in global styles isn't working at all. It's broken on trunk too so not a problem specific to this PR.
Duotone isn't working for the Site Logo Rounded variation either.
Block spacing isn't working within the Quote Plain variation, or within the Social Icons variations. Again it's an issue on trunk: the styles aren't being output at all.
Padding is being output for Table but seems to have no effect whatsoever.
Letter case and spacing are output with correct specificity on Tag Cloud but changes don't show in the editor (front end looks fine)
These should probably be investigated separately.