WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 5 months ago

#51554 closed defect (bug) (reported-upstream)

Twenty Twenty theme styles get in way within editor

Reported by: karmatosed Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: dev-feedback
Focuses: Cc:

Description

The editing experience has a preferences setting to turn off theme styling. Unfortunately, with this theme, turning off doesn't work.

You can see more of this reported in this GitHub issue: https://github.com/WordPress/gutenberg/issues/26037

Change History (18)

#1 @karmatosed
6 months ago

  • Summary changed from Twenty Twenty themes get in way within editor to Twenty Twenty theme styles get in way within editor

#2 @joyously
6 months ago

I think the editor option should be more specific, as it should not be expected to work for every theme.

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


6 months ago

#4 @davidbaumwald
6 months ago

  • Component changed from Themes to Bundled Theme

#5 @hellofromTonya
6 months ago

Notes from discussions in today's core scrub:

  • The issue appears to be in the theme itself
  • This issue does not exit in the Twenty Nineteen theme
  • @karmatosed "it's a real problem"

Let's see if we can get eyes on this one to get it resolved.

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


6 months ago

#7 follow-up: @kjellr
6 months ago

It sounds like this is probably due to the fact that Twenty Twenty uses the outdated enqueue_block_editor_assets hook to enqueue its editor styles, instead of the usual add_editor_style() method from the handbook.

In general, Twenty Twenty should switch to using the more traditional add_editor_style() method (though it would involve quite a bit of trial and error to rewrite the styles with a new scope), but I do think that the "Use theme styles" feature in Gutenberg should try to account for styles loaded that via enqueue_block_editor_assets anyway.

Many older themes will still enqueue their editor stylesheets that way, since it's still supported. Also, both Twenty Nineteen and Twenty Twenty-One use that enqueue_block_editor_assets method to enqueue custom color styles when they're set via the Customizer. Currently, these stylesheets will still be loaded even if "Use theme styles" is turned off.

#8 in reply to: ↑ 7 @joyously
6 months ago

Twenty Twenty uses the outdated enqueue_block_editor_assets hook

Can you point to where that hook is documented as "outdated"?
Many themes do use the add_editor_style function, but do not call the add_theme_support for editor styles because of being older than the block editor, or having styles that don't work with the way styles are prefixed when using that.

#9 @kjellr
6 months ago

Can you point to where that hook is documented as "outdated"?

To clarify: the hook is not depreciated, it's just not the way the handbook recommends that themes enqueue their stylesheets.

https://developer.wordpress.org/block-editor/developers/themes/theme-support/#enqueuing-the-editor-style

I haven't been able to track down when exactly the handbook stopped recommending enqueue_block_editor_assets for this purpose, but it was sometime before Nov 2018.

#10 @joyously
6 months ago

Because of a forum topic I was answering today, I'm reminded that this is a good time to point out that the add_theme_support call for the editor styles doesn't distinguish between a parent theme and a child theme. So if the parent is older, and uses add_editor_style for styling the Classic editor, and the child theme wants to add something to the block editor and calls add_theme_support('editor-styles'), then it could make a mess.

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


6 months ago

#12 @hellofromTonya
6 months ago

Was a decision been made yet if this fix is here or upstream?

Last edited 6 months ago by hellofromTonya (previous) (diff)

#13 @kjellr
6 months ago

I think it's both, really. 😄

Twenty Twenty should probably move to using add_theme_support for editor styles, but that'll be a relatively large refactor. I'm personally not 100% sure it's worth this specific benefit.

And on the Gutenberg end, the feature would ideally be able to handle themes that enqueue stylesheets via enqueue_block_editor_assets — either by checking for and dequeueing those stylesheets, or by hiding/disabling the "Theme Styles" checkbox when themes enqueue stylesheets this way.

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


5 months ago

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


5 months ago

#16 @hellofromTonya
5 months ago

Should the upstream GB issue be reopened?

#17 @kjellr
5 months ago

Should the upstream GB issue be reopened?

Yes I think so. I've reopened it and added some background. 👍

#18 @hellofromTonya
5 months ago

  • Milestone 5.6 deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

The Theme Team agree:

  • this issue should be fixed upstream.
  • the original GB issue was reopened.
  • this ticket can be closed.
Note: See TracTickets for help on using tickets.