-
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
Ensure root selector (body) is not wrapped in :root :where() #63726
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @mleathem. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
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 the rapid response on this fix @talldan 🚀
Quick question; it looks like this will address the PHP and frontend side of the issue, do we also need to update the JS side of global styles?
I have a suspicion that we'll also need to update the use-global-styles-output.js hook.
Similar to the top-level element-only selector fix, we could probably just add the skipSelectorWrapper
flag to the root block selector linked above.
Size Change: +4 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
a7e7d2a
to
594184c
Compare
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.
Appreciate the quick iteration here as well 🙇
This is now testing well for me. I can confirm the root body selector is back to body
after this PR and matches what it was with WP6.5.5.
I also gave this a smoke test against a range of block style variations and didn't spot any regressions there.
WP 6.5.5
Editor Before / After
Frontend Before / After
If there is a chance to get this into WP6.6.1 we'll need the test instructions updated for the latest changes and an extra approval or two.
Thanks @aaronrobertshaw, I've updated the test instructions. |
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 code change LGTM, too, and is testing well for me:
✅ Post and site editor styles target the simple body
selector
✅ In the non-iframed editor, styles target the editor wrapper as expected
✅ Styles on the site frontend target the simple body
selector
Looks good to land to me!
…e(). Pre-WordPress 6.6, the `body` selector was used for styles associated with the body. In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes. This change reverts the specificity increase, styles again use the `body` selector. Syncs PHP changes from WordPress/gutenberg#63726. Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromtonya. Fixes #61704. git-svn-id: https://develop.svn.wordpress.org/trunk@58856 602fd350-edb4-49c9-b593-d223f7449a82
…e(). Pre-WordPress 6.6, the `body` selector was used for styles associated with the body. In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes. This change reverts the specificity increase, styles again use the `body` selector. Syncs PHP changes from WordPress/gutenberg#63726. Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromtonya. Fixes #61704. Built from https://develop.svn.wordpress.org/trunk@58856 git-svn-id: http://core.svn.wordpress.org/trunk@58252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…e(). Pre-WordPress 6.6, the `body` selector was used for styles associated with the body. In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes. This change reverts the specificity increase, styles again use the `body` selector. Syncs PHP changes from WordPress/gutenberg#63726. Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromtonya. Fixes #61704. Built from https://develop.svn.wordpress.org/trunk@58856 git-svn-id: https://core.svn.wordpress.org/trunk@58252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…e(). Pre-WordPress 6.6, the `body` selector was used for styles associated with the body. In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes. This change reverts the specificity increase, styles again use the `body` selector. Syncs PHP changes from WordPress/gutenberg#63726. Reviewed by hellofromTonya. Merges [58856] and [58861] to the 6.6 branch. Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromTonya. Fixes #61704. git-svn-id: https://develop.svn.wordpress.org/branches/6.6@58874 602fd350-edb4-49c9-b593-d223f7449a82
…e(). Pre-WordPress 6.6, the `body` selector was used for styles associated with the body. In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes. This change reverts the specificity increase, styles again use the `body` selector. Syncs PHP changes from WordPress/gutenberg#63726. Reviewed by hellofromTonya. Merges [58856] and [58861] to the 6.6 branch. Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromTonya. Fixes #61704. Built from https://develop.svn.wordpress.org/branches/6.6@58874 git-svn-id: http://core.svn.wordpress.org/branches/6.6@58270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Fixes #63712
Trac backport ticket - https://core.trac.wordpress.org/ticket/61704
In WordPress 6.6, there was a general effort to lower and level specificity, but a couple of selectors seem to have mistakenly had their specificity raised.
The styles associated with the
body
are an example. In 6.5 these styles used the simplebody
selector. In 6.6 the selector is:root :where(body)
, an increase in specificity.Why?
These changes may cause some problems for themes, especially the typography styles in the body, which will cascade.
How?
Reverts the selector back to
body
props to @aaronrobertshaw for pointing me to the fix
Testing Instructions
Editor styles
body
element inside theedit-site-visual-editor__editor-canvas
iframe.body
selector and not a:root :where(body)
selector.Frontend styles
body
selector and not a:root :where(body)
selector.Expected:
Before: