-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Site Editor: don't render empty body tag #62769
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: -8 B (0%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
canvasMode === 'view' | ||
? `min-height: 100vh; ${ | ||
? `body{min-height: 100vh; ${ | ||
currentPostIsTrashed ? '' : 'cursor: pointer;' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why this UI related CSS is not outside the iframe, while the iframe can itself can be set to pointer-events:none
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I'm not sure. It was a legacy style pulled over in the unification PR
Looking at the component hierarchy, I'm assuming it could be passed down to VisualEditor
to BlockCanvas
via iframeProps
from the edit-site package.
What?
Fix trailing curly brace, and only render margin collapsing CSS on the body tag in canvas view mode.
Why?
To prevent
body{}}
from being rendered in the Site Editor in "edit" mode.How?
Only building the CSS string when the Site Editor canvas mode is "view".
I think that preserves the original intention of https://github.com/WordPress/gutenberg/pull/62146/files#diff-53f39da7a5f1f996f5359a2dd7b2747fb3d60a494523dd73dba946fab8e82592R144
Testing Instructions
Head over to the Site Editor. View the source of the Editor frame. Inside the body tag you should see the body rule
Now enter edit mode.
The body tag should not be there.