-
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
Fix CSS classes for the post editor iframe body. #68481
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: +3 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
d2d01b0
to
61e2e15
Compare
Looking into the failing e2e test... |
Flaky tests detected in aaee248. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13371841317
|
The fact some e2e tests intermittently fail and then suddenly pass makes debugging extremely time consuming and a little frustrating. Additionally, debugging locally is often unreliable, at least for me, because some tests fail locally, while they pass on GitHub, with no apparent reason. For example: On GH, the test Locally, that test passes. But, another test always fails locally for me thus making debugging basically impossible. It's not the first time that I face some tests failing locally and passing on GH and I'm not familiar enough with the testing framework to understand why. Not sure whether I'm missing something or if some special configuration is necessary but `I'd argue the tests should run consistently locally and GH otherwise debugging becomes extremely time consuming if not impossible. I'd appreciate some feedback from contributors more familiar than me with Playwright. It would be interesting to know if anyona already faced similar issues and whether I'm missing any configuration or steps. Thanks! |
Thanks for the ping, @afercia! That test is super flaky, and I'm also not sure what the exact cause is. I need to check if removing the "waiting for spinner" condition is safe. If I remember correctly, the spinner and canvas haven't been displayed simultaneously since some recent refactorings. |
773a863
to
3a0265e
Compare
@WordPress/gutenberg-core what would be the best way to add tests for this? They should:
|
3a0265e
to
477b2b9
Compare
@glendaviesnz when you have a chance, I'd appreciate your eyes on this new approach 🙏🏻 to make sure it doesn't introduce other problems like the one fixed in #60550 for Safari. |
I have not found any problems with the zoom out, or with any other body classes, in Safari. |
Thanks @carolinan for your testing and review. |
9e8dfb5
to
aaee248
Compare
aaee248
to
fda8fe3
Compare
@WordPress/gutenberg-core I'm going to merge this change as it's simple and self-contained. We tested it at our best and didn't notice regressions. If you notice any problems like the one fixed in #60550 for Safari no objections to revert it. |
Fixes #60299
Second attempt to fix this issue after #60300 was reverted for a bug in Safari, see #60616. A follow-up was planned but it never happened.
What?
In the post editor, the
is-dark-theme
CSS class gets removed from the iframe body when the iframe fully loads. This happens only in the post editor, it doesn't in the site editor as the implementation is different.Why?
The
is-dark-theme
CSS class is necessary to correctly style some UIs when a dark theme is in use.For example, for accessibility, the block placeholder text should use a sufficient contrast ratio when the theme is dark.
How?
useRefEffect
rather than in the iframeonLoad
callback.darktheme
to be used in the tests.I'm not sure there was a specific reason to set the classes after the iframe is fully loaded. The
onLoad
callback appears to be too late, as at that point the existing classes get replaced.In this PR the setting of the classes happens earlier, in the
useRefEffect
hook. It appears everything works as expected because at that point the iframe element is rendered. Theoretically there shouldn't be drawbacks but please double check any potential undesired side effect.Cc @glendaviesnz @ellatrix
Testing Instructions
Reproduce the issue on trunk:
load
event takes a while to fire.block-editor-iframe__body
to check the intial classes before the iframe fully loads are:block-editor-iframe__body editor-styles-wrapper is-dark-theme
block-editor-iframe__body editor-styles-wrapper post-type-post admin-color-fresh wp-embed-responsive
is-dark-theme
class is now missing.block-editor-iframe__body editor-styles-wrapper post-type-post admin-color-fresh wp-embed-responsive is-dark-theme
is-dark-theme
class isstill there.and observe the
admin-color-freshclass is now
admin-color-midnight`.post-type-post
class is nowpost-type-pag
.Testing Instructions for Keyboard
Screenshots or screencast