-
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 theme styles for the code block #36282
Conversation
The theme.json settings for the code block target `.wp-block-code > code` not `.wp-block-code`. Therefore, there is no way to override the theme.css styles using theme.json. This update resolved that.
I would love to see this approved and merged as it will allow me to remove CSS that is currently in my theme to unnecessarily override. |
@jasmussen sorry for the ping, but can I get your eyes on this one as well? It's another theme.json related issue. |
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 works fine for me, and seems like a good solution. I didn't test with theme.json overrides, so please do verify it works as intended, ideally with another quick test of the PR. But it looks good to me. Thank you!
Just ran another test with custom styles in theme.json and TT2 and my own FSE theme. All works as expected. In classic themes, the code block styling is the same as in trunk. 🙌 |
@jasmussen I believe this was automatically set for the Gutenberg 12.0 milestone. Now that Beta 1 is being pushed back further, do you think we can backport this to WP Beta? It's such a simple fix. |
I think so long as it has the "backport to wp" label, it will be up to the release leads to decide on/make sure it lands in 5.9. Given it's a bugfix, I don't personally see it as problematic, but I'll defer to those making the release! |
The theme.json settings for the code block target `.wp-block-code > code` not `.wp-block-code`. Therefore, there is no way to override the theme.css styles using theme.json. This update resolved that.
@ndiego This PR changed the text color to be hard coded to |
@carolinan that's a good question. That color was already there prior to this PR. The PR just corrected the specificity of the styles so they could be manipulated via theme.json. In many of the themes I am working on, we have customized the code block completely. Here's an example...
Personally, I would like there to be no set font color on the code block, but that might be a larger questions about WP style defaults. |
Followed up on the text color in #37816. |
Description
The theme.json settings for the code block target
.wp-block-code > code
not.wp-block-code
. Therefore, there is no way to override the theme.css styles using theme.json. This update resolves that.How has this been tested?
.wp-block-code > code
, but the default theme.css styles remain applied to.wp-block-code
.Screenshots
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).