Custom Colors: Fix block editor CSS in Gutenberg 22.6.0+ iframe context#47603
Custom Colors: Fix block editor CSS in Gutenberg 22.6.0+ iframe context#47603arthur791004 merged 2 commits intotrunkfrom
Conversation
Gutenberg 22.6.0+ renders the editor in an iframe for all themes, so the `#editor .editor-styles-wrapper` selector no longer matches inside the iframe. Add a dedicated `print_block_editor_css` method that extends the selector to also target `:root :where(.editor-styles-wrapper)` while keeping the original selector for backwards compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
|
Sync changes from 207833-ghe-Automattic/wpcom |
Code Coverage SummaryCoverage changed in 1 file.
Coverage check overridden by
Coverage tests to be added later
|
Pass array() instead of null for the $deps parameter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Related to THEME-132
Proposed changes
print_block_editor_css()method toColors_Manager_Commonthat adapts Custom Colors CSS selectors for the block editor iframe context introduced in Gutenberg 22.6.0+.enqueue_block_editor_assetshook to use the new method instead ofprint_theme_css().#editor .editor-styles-wrapperselectors to also match:root :where(.editor-styles-wrapper)inside the iframe, while preserving the original selector for backwards compatibility with older Gutenberg versions.wp_add_inline_style()instead of printing a raw<style>tag, which is the correct approach for theenqueue_block_editor_assetshook.Other information
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
wp_head) still renders custom colors correctly (no regression).