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

Editor styles are applied inconsistently for themes that do not support theme.json #35730

Closed
chad1008 opened this issue Oct 18, 2021 · 4 comments · Fixed by #35736
Closed

Editor styles are applied inconsistently for themes that do not support theme.json #35730

chad1008 opened this issue Oct 18, 2021 · 4 comments · Fixed by #35736
Assignees
Labels
[Status] In Progress Tracking issues with work in progress

Comments

@chad1008
Copy link
Contributor

Description

If a theme does not support theme.json, editor styles are not applied on some themes, and text is rendered in the browser's default font.

This appears to have been introduced in #35424, when the check for WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() was removed.

In testing a few different themes, it does appear there are theme-specific variables at play as well, and not simply whether or not the theme supports theme.json. How and when the theme declares its editor styles may be a factor (ie add_editor_style() vs wp_enqueue_style() and/or init vs enqueue_block_editor_assets for example)

Step-by-step reproduction instructions

  1. Activate a theme such as Nucleare, which happens to be impacted
  2. With Gutenberg v11.7 active, create a new post. Note the browser default font
  3. Close the editor, and roll back to Gutenberg v11.6.
  4. Create another new post, and note that the theme's editor styles are applied.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@oandregal
Copy link
Member

oandregal commented Oct 18, 2021

Hey, thanks for reporting.

I can indeed confirm that removing this check has caused this bug. I'm a bit puzzled as to why, though.

My best hypothesis at the moment is that removing this check has surfaced at an existing bug that was dormant. I checked and, for the Nucleare theme, if the $settings['styles'] is empty after this code runs, everything works as expected. However, after #35424 there are no themes with empty $settings['styles'] because we always add the core presets for all. So I guess that change is affecting other parts of the codebase. I'm still trying to understand where/why/how.

@oandregal
Copy link
Member

mmm, I think I've got a lead. At #34439 (Gutenberg 11.5) we added some styles for themes that didn't add any editor styles. Nucleare is one of such themes. However, by doing #35424 all the themes provide some styles: at least there are the core presets.

I'm exploring a potential fix at #35736

@oandregal
Copy link
Member

Created a second PR at #35737 I think this is a better approach, but would like to hear people's thoughts.

@Sifrqitt
Copy link

As soon as I upgraded the Gutenburg plugin to the latest 11.7.1 , from the previous version 11.6.0, the fonts displayed in the editor no longer match my theme fonts, they seem to have reverted to some default fonts (see attached picture). I don't like it at all because I like my theme fonts, so I will be reverting to the previous version of Gutenburg, until this is fixed.

Using latest Wordpress version 5.8.1
Capture2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress
Projects
None yet
3 participants