Upgrade nudge: replace CSS class to avoid Gutenberg editor iframe warning#50260
Open
shsajalchowdhury wants to merge 2 commits into
Open
Upgrade nudge: replace CSS class to avoid Gutenberg editor iframe warning#50260shsajalchowdhury wants to merge 2 commits into
shsajalchowdhury wants to merge 2 commits into
Conversation
…arning The upgrade-nudge component adds a '.wp-block' CSS class when rendered in the editor-canvas context. The Gutenberg iframe compatibility checker (get-compatibility-styles.js) detects stylesheet content containing the string '.wp-block' and emits a console warning: "editor-jetpack-sidebar-css was added to the iframe incorrectly." This CSS is pulled into several bundles (Social sidebar, external media, etc.) through a barrel-file re-export chain in shared-extension-utils, where unused components like Nudge are still evaluated due to side-effect CSS imports. Fix: Replace '.wp-block' with a custom '.jetpack-nudge-canvas' class. This removes the '.wp-block' string from the stylesheet entirely, so Gutenberg's compatibility checker no longer flags it, while preserving the same left/right alignment styling for paid plan upgrade nudges in the editor canvas. Fixes Automattic#46416
Contributor
|
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 🤖 |
ca834f2 to
65b8d97
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #46416
Why
The upgrade-nudge component adds a CSS class when rendered in the
editor-canvascontext. The Gutenberg iframe compatibility checker (get-compatibility-styles.js) scans all stylesheets injected into the editor iframe for content matching the string.wp-block. When it finds it in a stylesheet that wasn't properly enqueued viablock.json, it emits warnings:This CSS is pulled into multiple bundles (Social sidebar, external media) through a barrel-file re-export chain in
shared-extension-utils, where unused components likeNudgeare still evaluated due to side-effect CSS imports — JavaScript tree-shaking can't eliminate the module because the CSS import inindex.jsxis a side-effect.How
Replace the generic
.wp-blockclass with a custom.jetpack-nudge-canvasclass. This:.wp-blockstring from the stylesheet entirelyTesting Instructions
editor-jetpack-sidebar-css was added to the iframe incorrectlyChangelog
Does this pull request change what data or activity we track or use?
No. This change only renames a CSS class from
.wp-blockto.jetpack-nudge-canvas— no data collection or tracking changes.Testing instructions
editor-jetpack-sidebar-css was added to the iframe incorrectly