Edit: I didn't adequately research this question before posting it, so the behavior I'm describing is much older than I realized. The issue I was observing comes from elsewhere. Leaving the original question here for context.
add_editor_style
copies the styles of the body {}
selector from the specified stylesheet into the class selector .editor-styles-wrapper {}
. This isn't well-documented, as far as I can tell, other than in a comment in the documentation.
Since upgrading to 6.3 (or possibly earlier), I notice that the styles on html {}
are also being copied to .editor-styles-wrapper {}
.
So if you load a file like editor-styles.css
that contains the following declarations:
html {
font-size: 100%;
}
body {
font-size: 1.2rem;
}
WordPress will inject these styles into the editor as:
.editor-styles-wrapper {
font-size: 100%;
}
.editor-styles-wrapper {
font-size: 1.2rem;
}
(Previously, the html {}
styles would have just been dropped.)
Is this intentional? Is it documented anywhere? This has led to some slight breakages in my editor styles.
add_editor_style
are no longer prependingeditor-styles-wrapper
which has broken all my block editor css!