Opened 4 years ago
Closed 4 years 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
@
4 years ago
- Summary changed from Twenty Twenty themes get in way within editor to Twenty Twenty theme styles get in way within editor
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
4 years ago
#5
@
4 years 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.
4 years ago
#7
follow-up:
↓ 8
@
4 years 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
@
4 years 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
@
4 years 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.
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
@
4 years 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.
4 years ago
#13
@
4 years 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.
4 years ago
This ticket was mentioned in Slack in #core-themes by hellofromtonya. View the logs.
4 years ago
#16
@
4 years ago
Should the upstream GB issue be reopened?
I think the editor option should be more specific, as it should not be expected to work for every theme.