-
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
Make sure the CSS class is-dark-theme is added to the editor iframe body #60300
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +42 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
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.
Fine with me
…ody. (WordPress#60300) Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
This change breaks the iframe setup in Safari, so I think we need to revert this and look for a different approach to maintain the dark theme class. I will take a look and see what can be done. |
Fixes #60299
Cc @youknowriad @ellatrix
When you have a chance, I'd appreciate a review, as this is a blocker for another issue I'm working on.
For more details, please see the associated issue.
What?
When a theme has a dark background, the editor is supposed to set a CSS class
is-dark-theme
to the editor iframe document body. This works in the Site editor, It doesn't in the Post editor.The editor
Iframe
component has some internal logic to get some of the CSS classes set on the main document body like for examplepost-type-post admin-color-fresh wp-embed-responsive
and then copy them to the iframe document body.That makes sense but by doing so it replaces the
is-dark-theme
class, if it is set. Actually, I think the wholebody
is replaced? Regardless, theis-dark-theme
class is missing.This happens only in the Post editor. In the Site editor, the CSS class is present so that I'm guessing it's also something related to timing.
Why?
The
is-dark-theme
CSS class is necessary for some styling in the editor. The lack of this CSS class is also a blocker for #60275How?
Iframe
component handling of the CSS classes also gets the classes that are initially set on the iframe body.Testing Instructions
is-dark-theme
is not set in the post editor #60299block-editor-iframe__body editor-styles-wrapper
.is-dark-theme
.block-editor-iframe__body editor-styles-wrapper
.is-dark-theme
.is-dark-theme
stays there also when the iframe is fully loaded.Testing Instructions for Keyboard
Screenshots or screencast