-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Remove the border property from the body element on previews. #46946
Conversation
@@ -91,6 +91,9 @@ function ScaledBlockPreview( { | |||
documentElement.style.width = '100%'; | |||
bodyElement.style.padding = __experimentalPadding + 'px'; | |||
|
|||
// Necessary for proper previews of styles with border styles assigned to the body. | |||
bodyElement.style.border = '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.
It's interesting that some styling is set using JavaScript here and some is set using CSS on line 52 above. Did you consider putting border: none
into the CSS above? What's the better approach?
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.
Thanks for the CR, @noisysocks :)
I initially chose that place, so that I can add some inline docs explaining the reason behind removing the border. Maybe line 52 is cleaner, I've just moved it there.
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.
Much of a muchness I suppose, thanks for considering 😀
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.
Works well, the examples no longer have a border.
What?
Fixing #46874.
Why?
Because the style book and the different previews don’t show examples properly on variants where there's a body border defined.
How?
Removing the body border from the preview so that the styles preview doesn't look borked.
Testing Instructions
Screenshots or screencast
gutenberg-46874.mov