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

Blocks: Differences between editor and frontend #29976

Closed
14 tasks done
scruffian opened this issue Mar 18, 2021 · 21 comments
Closed
14 tasks done

Blocks: Differences between editor and frontend #29976

scruffian opened this issue Mar 18, 2021 · 21 comments
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Themes Questions or issues with incorporating or styling blocks in a theme.

Comments

@scruffian
Copy link
Contributor

scruffian commented Mar 18, 2021

Latest Comments:

Editor Frontend
Screenshot 2021-03-18 at 11 45 49 Screenshot 2021-03-18 at 11 45 44
The comment text is smaller in the editor than in the frontend

Archives:

Editor Frontend
Screenshot 2021-03-18 at 11 50 37 Screenshot 2021-03-18 at 11 50 41
The dropdown appearance is different and has a label

File block:

Editor Frontend
Screenshot 2021-03-18 at 11 35 25 Screenshot 2021-03-18 at 11 35 44
The file name appears like a link in the frontend but not in the editor

Search block:

Editor Frontend
Screenshot 2021-03-18 at 11 54 44 Screenshot 2021-03-18 at 11 54 49
The placeholder and label font is a different font family and color.

Cover block:

Editor Frontend
Screenshot 2021-03-18 at 12 10 32 Screenshot 2021-03-18 at 12 10 38
The cover block has a bckground color in the editor but not the frontend

Quotation:

Editor Frontend
Screenshot 2021-03-18 at 12 13 53 Screenshot 2021-03-18 at 12 13 47
The "This citation is bold" is a different font size

When the block styles are disabled:

Editor Frontend
Screenshot 2021-03-19 at 14 44 43 Screenshot 2021-03-19 at 14 44 49
In the frontend the citation text is italic, in the editor its smaller

Paragraph:

Editor Frontend
Screenshot 2021-03-18 at 12 16 23 Screenshot 2021-03-18 at 12 16 30
Screenshot 2021-03-19 at 13 00 45 Screenshot 2021-03-19 at 13 00 51
There is additional space in the text around the drop cap. Also when paragraphs have a background color the edge of the block aligns with the text in the editor, but the text aligns with other text blocks in the frontend.

Columns:

Editor Frontend
Screenshot 2021-03-18 at 13 36 40 Screenshot 2021-03-18 at 13 36 48
There is a bigger margin at the top of the columns block in the editor.

Post Title:

Editor Frontend
Screenshot 2021-03-19 at 13 05 09 Screenshot 2021-03-19 at 13 05 20
The font size is bigger in the editor

Opting out of block styles:

Table:

Editor Frontend
Screenshot 2021-03-19 at 14 11 47 Screenshot 2021-03-19 at 14 11 38
Tables in the frontend don't have a border

Buttons:

Editor Frontend
Screenshot 2021-03-19 at 14 31 29 Screenshot 2021-03-19 at 14 31 22
Screenshot 2021-03-19 at 14 31 44 Screenshot 2021-03-19 at 14 31 51
In the frontend buttons overlap each other horizontally. The large button at the bottom is aligned left in the editor but centered in the editor.

Group:

Editor Frontend
Screenshot 2021-03-19 at 14 37 58 Screenshot 2021-03-19 at 14 37 42
The group block extends to the edge of the screen in the editor but not in the frontend

Embed:

Editor Frontend
Screenshot 2021-03-19 at 14 53 49 Screenshot 2021-03-19 at 14 53 56
Screenshot 2021-03-19 at 14 53 20 Screenshot 2021-03-19 at 14 53 26
Screenshot 2021-03-19 at 14 53 05 Screenshot 2021-03-19 at 14 53 10
Screenshot 2021-03-19 at 14 52 48 Screenshot 2021-03-19 at 14 52 54
Screenshot 2021-03-19 at 14 52 28 Screenshot 2021-03-19 at 14 52 33
Screenshot 2021-03-19 at 14 52 05 Screenshot 2021-03-19 at 14 52 09
Screenshot 2021-03-19 at 14 51 35 Screenshot 2021-03-19 at 14 51 46
The embed blocks are a different size on the frontend and the editor

Separator:

Editor Frontend
With block styles:
Screenshot 2021-03-23 at 16 54 05 Screenshot 2021-03-23 at 16 54 11
Without block styles
Screenshot 2021-03-23 at 16 55 22 Screenshot 2021-03-23 at 16 55 33
The 100px max with is really problematic. Also not sure why the color gets lost

There is also a difference in margins for all blocks

TODO:

@youknowriad
Copy link
Contributor

What's the problem for the buttons block (aside the margins between the blocks which are a separate thing cross blocks)

@scruffian
Copy link
Contributor Author

What's the problem for the buttons block (aside the margins between the blocks which are a separate thing cross blocks)

That's all :)

@youknowriad
Copy link
Contributor

@scruffian Do you think we can add a TODO list to the issue description to help clarify what's done, what's remaining...

@youknowriad youknowriad added [Feature] Full Site Editing [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Blocks Overall functionality of blocks labels Mar 19, 2021
@scruffian
Copy link
Contributor Author

@scruffian Do you think we can add a TODO list to the issue description to help clarify what's done, what's remaining...

Done! I added another one I found for background colors...

@youknowriad
Copy link
Contributor

@scruffian do you know we can clarify what is different for each block like:

  • Buttons: margin
  • Block: color for links, background ...

Sorry if I'm asking too much 😬 It's something you know right away cause you did the screenshot but it might not be obvious by just looking at the screenshots.

@MaggieCabrera
Copy link
Contributor

I suppose you did these with Empty theme, right? I just wanted to point out that even though empty theme doesn't add css, it does include some custom supports and as we've found, removing things like add_theme_support( 'editor-styles' ); causes differences between the frontend and the editor.

@scruffian
Copy link
Contributor Author

I added some details about the differences between the blocks under each screenshot.

@scruffian
Copy link
Contributor Author

I suppose you did these with Empty theme, right? I just wanted to point out that even though empty theme doesn't add css, it does include some custom supports and as we've found, removing things like add_theme_support( 'editor-styles' ); causes differences between the frontend and the editor.

Yes, I did these tests with block styles enabled (add_theme_support( 'wp-block-styles' )). We should also do the same tests without this enabled.

These styles should not be loading in the editor unless the theme opts in since #29252 merged.

@scruffian
Copy link
Contributor Author

I added some more differences which I found when they block styles are disabled.

@youknowriad
Copy link
Contributor

@scruffian I haven't been able to reproduce the "Cover" block issue above, any example markup?

@MaggieCabrera
Copy link
Contributor

@scruffian I haven't been able to reproduce the "Cover" block issue above, any example markup?

I couldn't reproduce myself, and I think he was using the content from https://theamdemo.wordpress.com/2019/06/24/gutenberg-cover/ I can give you access to it

@scruffian
Copy link
Contributor Author

This seems to happen when using a background color that isn't defined, e.g.

<!-- wp:cover {"url":"https://theamdemo.files.wordpress.com/2020/10/qi-bin-w4hbafegiac-unsplash.jpg","id":28,"overlayColor":"red","minHeight":100,"minHeightUnit":"vh"} -->
<div class="wp-block-cover has-red-background-color has-background-dim" style="min-height:100vh"><img class="wp-block-cover__image-background wp-image-28" alt="" src="https://theamdemo.files.wordpress.com/2020/10/qi-bin-w4hbafegiac-unsplash.jpg" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p class="has-text-align-center has-large-font-size">Full height Cover</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->

@youknowriad
Copy link
Contributor

For the drop cap, for me, it's the same between frontend and backend, you can compare properly by having a long text in the paragraph to wrap the drop cap cause otherwise the difference you'll have is related to the margins (which is a cross block issue I'm leaving for its own issue as it's kind of big)

@youknowriad
Copy link
Contributor

youknowriad commented Mar 25, 2021

The Post Title block seems to be in the same size for me (default heading sizes)

@youknowriad
Copy link
Contributor

Tables also look the same for me, I do see borders on the frontend.

@youknowriad
Copy link
Contributor

I have a PR for the buttons block but I wasn't able to reproduce the center aligned one.

@youknowriad
Copy link
Contributor

I guess the group block difference above is about the "padding" in the site editor right? If that's the case, I'll leave that separate because this padding has some wider implications

@paaljoachim
Copy link
Contributor

Checking in.
What is the status of this issue?

@scruffian
Copy link
Contributor Author

All of these issues were fixed I think we can close this.

@scott8035
Copy link

Was there a common theme among the fixes to all these issues? I'm having the same problem with a custom block created with ACF Pro, and I've no idea where to start looking.

@scruffian
Copy link
Contributor Author

@scott8035, it will really depend on the block. Ideally you want the markup to be the same in the editor and on the frontend, and then also to use the same CSS in both places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Themes Questions or issues with incorporating or styling blocks in a theme.
Projects
None yet
Development

No branches or pull requests

5 participants