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

Fonts in layout preview are not correct in WP 5.9 #682

Open
laurelfulford opened this issue Jan 13, 2022 · 2 comments
Open

Fonts in layout preview are not correct in WP 5.9 #682

laurelfulford opened this issue Jan 13, 2022 · 2 comments
Assignees
Labels
bug Something isn't working wp 5.9

Comments

@laurelfulford
Copy link
Contributor

laurelfulford commented Jan 13, 2022

As of WP 5.9 RC 2, the layout preview no longer uses the correct fonts.

In WP 5.8.3, the preview looks like this - the headers use a sans-serif font, and the button is bolded:

Screen Shot 2022-01-12 at 4 04 18 PM

In 5.9, the Headings use a serif font, and the button is no longer bolded:

Screen Shot 2022-01-12 at 4 05 48 PM

In the editor in WP 5.9, the headings and button are still styled correctly:

Screen Shot 2022-01-12 at 4 03 45 PM

It may have made more sense to bundle this issue with #681, as they may all be related, so please let me know if I should just move this information over there -- thank you!

@laurelfulford laurelfulford added bug Something isn't working wp 5.9 labels Jan 13, 2022
@miguelpeixe
Copy link
Member

This appears to be a bug on the Gutenberg side, which I just filed an issue: WordPress/gutenberg#37961.

5.9 is introducing iframed editors that are being used on <BlockPreview />, which is the component we use to render the layout previews and also part of the functionality behind the Posts Inserter block.

Iframes do not inherit styles from the parent document so there is a strategy to pass the styles on to the iframed blocks, which appears to be faulty on Firefox.

This strategy is understandably temporary so we shouldn't rely on the fix. We can resolve this issue by:

  1. Compile block styles individually and use the block editorStyle attribute
  2. Use add_editor_style() for global editor styling until Block editor: add a way to extend style dependency handles for editor content WordPress/gutenberg#37466 is not released

Note that the use of add_editor_style() requires a specific CSS structure.

@laurelfulford
Copy link
Contributor Author

This Newspack Block preview issue sounds like it might have the same underlying cause 😬 it's also only happening in Firefox: Automattic/newspack-blocks#1013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wp 5.9
Projects
None yet
Development

No branches or pull requests

2 participants