Custom Colors: fix theme background color ignoring 'Use theme styles' toggle#49060
Custom Colors: fix theme background color ignoring 'Use theme styles' toggle#49060msilbers wants to merge 1 commit into
Conversation
… toggle Classic themes (Twenty Sixteen, Twenty Twenty, etc.) with custom background colors inject those colors into the block editor via wp_add_inline_style(), which bypasses Gutenberg's style management — the "Use theme styles" toggle has no effect on Atomic/WoA sites. Switch the CSS injection from enqueue_block_editor_assets + wp_add_inline_style() to the block_editor_settings_all filter with __unstableType => 'theme', so Gutenberg treats them as theme styles and the toggle controls them. Companion to https://github.a8c.com/Automattic/wpcom/pull/218901 (Simple sites). Fixes https://linear.app/a8c/issue/EDI-504
|
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 🤖 🔴 Action required: Please include detailed testing steps, explaining how to test your change, like so: 🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so: 🔴 Action required: Please add missing changelog entries for the following projects: Use the Jetpack CLI tool to generate changelog entries by running the following command: Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
What
Fixes EDI-504 — theme background color displays in the editor when "Use theme styles" is disabled on classic themes (Atomic/WoA sites).
Companion PR to wpcom #218901 which fixes the same issue on Simple sites.
Why
Classic themes (Twenty Sixteen, Twenty Twenty, etc.) with custom background colors inject those colors into the block editor via
wp_add_inline_style(), which bypasses Gutenberg's style management. The "Use theme styles" toggle has no effect on these injected styles.How
Switches the CSS injection from
enqueue_block_editor_assets+wp_add_inline_style()to theblock_editor_settings_allfilter with__unstableType => 'theme', so Gutenberg treats them as theme styles and the toggle controls them.The existing
print_block_editor_css()method is left in place as it may be called from other contexts or subclasses.Testing
Note: Verified via code review and parity with the wpcom Simple site fix. Reviewer input on live-site behavior requested.
Note: The Linear issue was auto-marked "In Progress" when the wpcom PR opened. This is review-ready, not actively worked by an engineer.