-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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() #7061
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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, with the styles for the root selector now being applied to body
instead of :root :where(body)
👍. Tested with a couple of different block and classic themes.
The code change also looks good and simple. I think this will be a good fix to get in for 6.6.1. LGTM!
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 @talldan 👍
This is testing as per WordPress/gutenberg#63726.
Before | After |
---|---|
Before we get this comitted, I think we will need to add a @since 6.6.1
comment as well as @ticket 61704
comments to all the affected tests.
Thanks for spotting that. Linty things should be all fixed in the last two commits 👍 |
Thanks the |
8a39a76
to
4f7001f
Compare
* @since 6.6.1 Avoid applying `:root :where()` wrapper to top-level element-only selectors. | ||
* @since 6.6.2 Avoid applying `:root :where()` wrapper to root selectors. |
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.
These 2 @since
shouldn't be necessary, as they are both bugfixes. @since
is added for changes in functionality, function parameter(s), return types, filters, etc.
The commit history will provide the context of the bugfix changes.
* @since 6.6.1 Avoid applying `:root :where()` wrapper to top-level element-only selectors. | |
* @since 6.6.2 Avoid applying `:root :where()` wrapper to root selectors. |
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.
-
Tested before and after on
trunk
and the 6.6 branch (see Test Report) - can reproduce and this patch resolves it ✅ -
Double checked changes with its Gutenberg PR - confirmed its a clean merge of PHP changes ✅
LGTM for commit ✅
16de2a2
to
97b197a
Compare
Committed in r58856 |
Trac ticket: https://core.trac.wordpress.org/ticket/61704
Gutenberg issue: WordPress/gutenberg#63712
Gutenberg PR: WordPress/gutenberg#63726
What?
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
Note that unlike the gutenberg PR, the core backport only affects the frontend styles. The editor styles will be fixed by updating the packages from gutenberg.
props to @aaronrobertshaw for pointing me to the fix
Testing Instructions
body
selector and not a:root :where(body)
selector.Expected:
Before:
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.