WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#53388 closed defect (bug) (duplicate)

Block widgets in the editor are not reflecting how they will look on the site

Reported by: desrosj Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.8
Component: Widgets Keywords: has-screenshots
Focuses: Cc:

Description

While editing block widgets, many blocks do not accurately reflect how they will actually look on the front end of the site.

If this responsibility is on the theme, then the bundled themes need to be updated to better match.

Attachments (2)

edit-widgets-screen.png (167.6 KB) - added by desrosj 3 months ago.
actual-front-end.png (161.1 KB) - added by desrosj 3 months ago.

Download all attachments as: .zip

Change History (11)

#1 @desrosj
3 months ago

In my screenshots, I'm using the Twenty Twenty-One theme. It feels strange that some of the widgets have default styling, and others don't.

Last edited 3 months ago by desrosj (previous) (diff)

This ticket was mentioned in Slack in #core by chaion07. View the logs.


3 months ago

#3 @jorbin
3 months ago

I think that there are two pieces to this:

1) There should be better generic default styling since of the blocks don't look great as is and
2) The default themes should include better personalization.

I also think there should be a devnote to call out and encourage this personalization

#4 @caseymilne
3 months ago

Is there any way that styles from themes that apply to these blocks could be repurposed by the editor without having to specify them? Meaning could we make it easier for a theme to just focus on styles for the front-end, and then the editor has a way to grab those styles and parse them if they conform to a a certain structure, such as wrapping them in comments like:


/*
 * EditorBlockStyle
 * block-target: paragraph
 */

h2 {
  font-size: 1.2em;
}

/* /EditorBlockStyle */

Then the editor would need to open the theme stylesheet, parse out all the block target sections and combine them into an editor stylesheeet.

#5 @noisysocks
3 months ago

1) There should be better generic default styling since of the blocks don't look great as is and

Is there any way that styles from themes that apply to these blocks could be repurposed by the editor without having to specify them?

A potential solution here is to implement editor styles in the widgets editor, see GB26163. There are some design issues with implementing this, though. @tellthemachines is working on determining how feasible it is to do this in time for WordPress 5.8.

2) The default themes should include better personalization.

I also think there should be a devnote to call out and encourage this personalization

Agreed. All of the bundled themes should ideally be updated to work nicely with blocks which can now be added to widget areas. I can work on getting a dev note out. Do you know of anyone who could volunteer to work on the bundled themes?

Version 0, edited 3 months ago by noisysocks (next)

This ticket was mentioned in Slack in #core-themes by noisysocks. View the logs.


3 months ago

#7 @andraganescu
3 months ago

Advancing the issue, @isabel_brison made a couple PRs to see if it’s viable to include theme editor styles in the new widgets editor at this stage. They need to be tested together, because the core one loads the actual styles and the Gutenberg one fixes some consequent styling issues in the editor. Let's see what the experience of using theme block styles is.

#8 @noisysocks
3 months ago

  • Milestone 5.8 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I'm going to close this ticket in favour of smaller tickets for each of the three seperate but related issues at play here, described below.

1) Editor styles

The widgets block editor does not currently load editor styles. This is why blocks appear unstyled.

https://cldup.com/_MUIzxa7-8-3000x3000.png

This is a missing feature, not a bug, as the widgets screen has never supported editor styles or WYSIWYG editing.

Implementing this would make it so that blocks look the same in both the widgets block editor and on the site frontend.

This is tracked by GB26163 and #53344. @isabel_brison is working on a patch in #53344. It might be possible to add this in time for 5.8 if we can sort out the issues raised in GB32683.

2) Default block styles

With editor styles unavailable or turned off, some blocks do not look right. This is most apparent with the Latest Posts and Latest Comments blocks.

https://cldup.com/EyC0Wi3CPL-2000x2000.png

Note that this bug also occurs in the post editor if you turn off Preferences → Use theme styles.

https://cldup.com/nWrT1jcRln-3000x3000.png

It also affects the block editor in the Customizer.

https://cldup.com/Q-tRefg_-Q-2000x2000.png

This needs to be fixed regardless of whether or not we add editor styles to the widgets editor, because editor styles can be turned off and the Customizer will not support them.

I've opened GB32718 to track this issue.

3) Bundled theme issues

There are minor styling issues to do with blocks in some of the bundled themes. For example, in Twenty Twenty-one, the post title in the Latest Posts block should have a regular font size instead of a heading font size.

https://cldup.com/hNqTvVxBvC-2000x2000.png

I looked briefly and saw the following issues:

  • Twenty Twenty-one: Headings in Latest Posts block are too large.
  • Twenty Seventeen: Extra padding in Latest Comments block.
  • Twenty Sixteen: Extraneous separator above Latest Comments block.
  • Twenty Fourteen: Text has low contrast in Latest Comments block.
  • Twenty Thirteen: Extra padding in Latest Comments block.
  • Twenty Ten: Extra padding on left of Latest Posts block.

I've opened #53422 to track this issue.

#9 @desrosj
3 months ago

In 51200:

Widgets: Add editor styles to the widgets block editor.

This updates the widgets screen to load the editor styles in the same way as the post editor. This combined with the package updates in [51198] and [51199] ensures that the blocks added to sidebars more accurately reflect what will be displayed on the front end of the site.

Props isabel_brison, noisysocks, andraganescu, audrasjb, jorbin, caseymilne, desrosj.
Fixes #53344. See #53388.

Note: See TracTickets for help on using tickets.