Skip to content
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

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

juanfra
Copy link
Member

@juanfra juanfra commented Jan 6, 2023

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

  1. Activate TT3 and select Whisper style variant
  2. Open Style book
  3. Notice the bottom border of every example is not cut
  4. Open Styles again > Blocks and notice the previews are no longer cut off.

Screenshots or screencast

gutenberg-46874.mov

@@ -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';
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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 😀

@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended [Feature] Inserter The main way to insert blocks using the + button in the editing interface Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Jan 9, 2023
@juanfra juanfra requested review from noisysocks and removed request for ellatrix January 9, 2023 09:25
Copy link
Contributor

@carolinan carolinan left a 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.

@noisysocks noisysocks merged commit 38eac5d into WordPress:trunk Jan 10, 2023
@github-actions github-actions bot added this to the Gutenberg 15.0 milestone Jan 10, 2023
@juanfra juanfra deleted the fix/46874 branch January 11, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants