-
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
Update: Target global styles to the body element instead of :root #31302
Update: Target global styles to the body element instead of :root #31302
Conversation
Size Change: -3 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
I'm looking at this in relation to issue #35840 and trying to understand the reason for moving from You mention...
Am I right in thinking that you are going to use the Would it be possible to keep custom properties in Thanks for your help. |
The arguments for the change in #27478 don't seem to be based on any real reason. |
Many existing solutions inside and outside the WordPress ecosystem use Also, as linked and proven in #35840, moving the rules from |
It looks like the consequences for CSS custom properties were not completely thought through. Particularly, if anyone has built a JavaScript app that interacts with the global properties, they most likely use
or an equivalent way to set these. Similarly this W3C page on how to interact with them in JS uses When all properties are by default set on |
Bumping this again as pull request #42084 which addressed the issue was marked as “not a priority”. I'd like to know why this isn't a priority, and how the development team came to this conclusion. |
This is still a problem, see #42084 and #35840. cc @jorgefilipecosta. |
The "development team" was essentially me. #42084 lost all traction from reviewers and testers, despite being open for months. The good news is that PRs can be cheaply reopened when issues resurface. 👍🏻 |
Closes: #27478
Currently, the global styles target the :root selector. In a HTML element the :root selector maps to HTML element. It seems more correct to target body for the global styles use case. And will allow for things like margin and padding.
The body selector has lower specificity than :root so this change may have some impact.
How has this been tested?
I verified global colors and typography settings still work as before.
I applied preset a global text color, and I changed that color using the palette editor and verified the text color of the editor live update for the new color value.