Add styles to stop classic block editor buttons from inheriting italics from themes #11132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a theme includes style for the
i
tag in the classic editor CSS, and that stylesheet is pulled into Gutenberg viaadd_theme_support( 'editor-styles' )
, it can cause the buttons in the classic block to be italicized. This is because the classic editor styles are added inline, overriding thefont-style: normal
added to the.mce-ico
class in the TinyMCE styles.Admittedly, this is kind of an odd case -- the
i
tag is deprecated in the HTML spec, and is usually used for icons because of that: it's usually not styled. But since the default themes are built with backwards compatibility in mind, most do include some reset styles for this tag. And because of the nature of default themes, how they do this is often copied as a best practice for other themes.This issue was brought up in #11034, and was moved to be a default theme issue (https://core.trac.wordpress.org/ticket/45188) because it seemed specific to Twenty Seventeen. It turns out it's present in all older default themes but Twenty Thirteen.
Screenshots
Before (from #11034):
After:
Types of changes
This change updates CSS, to reiterate some styles already present in Gutenberg, but with a more specific selector so they can't be overwritten by something inline.
Checklist: