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. |
* Fix CSS classes for the post editor iframe body. * Remove canvas loader CSS animation for testing purposes. * Restore canvas loader CSS animation previously removed for testing purposes. * Add test theme and post editor tests. * Add tests for the site editor. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: colinduwe <colind@git.wordpress.org>
* Fix CSS classes for the post editor iframe body. * Remove canvas loader CSS animation for testing purposes. * Restore canvas loader CSS animation previously removed for testing purposes. * Add test theme and post editor tests. * Add tests for the site editor. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: colinduwe <colind@git.wordpress.org>
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-themeCSS 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-themeCSS 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?
useRefEffectrather than in the iframeonLoadcallback.darkthemeto 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
onLoadcallback 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
useRefEffecthook. 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:
loadevent takes a while to fire.block-editor-iframe__bodyto check the intial classes before the iframe fully loads are:block-editor-iframe__body editor-styles-wrapper is-dark-themeblock-editor-iframe__body editor-styles-wrapper post-type-post admin-color-fresh wp-embed-responsiveis-dark-themeclass is now missing.block-editor-iframe__body editor-styles-wrapper post-type-post admin-color-fresh wp-embed-responsive is-dark-themeis-dark-themeclass isstill there.and observe theadmin-color-freshclass is nowadmin-color-midnight`.post-type-postclass is nowpost-type-pag.Testing Instructions for Keyboard
Screenshots or screencast