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

Previews appear un-styled when using a block theme #37292

Closed
jffng opened this issue Dec 10, 2021 · 4 comments · Fixed by #37296
Closed

Previews appear un-styled when using a block theme #37292

jffng opened this issue Dec 10, 2021 · 4 comments · Fixed by #37296
Assignees
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@jffng
Copy link
Contributor

jffng commented Dec 10, 2021

Description

Block pattern previews in the pattern inserter, as well as mobile and tablet content previews, are appearing un-styled when using a block theme. I've tested using Twenty Twenty-Two and tt1-blocks. Also verified this is not happening in core trunk.

Step-by-step reproduction instructions

  1. Activate a block theme like Twenty Twenty-Two
  2. Go to a post and insert a pattern
  3. Verify the pattern appears unstyled
  4. Insert a pattern, verify it appears as expected (styled) in the post
  5. Change the preview to "Tablet", and "Mobile", verify the styles disappear.

Screenshots, screen recording, code snippet

Kapture.2021-12-10.at.11.18.27.mp4

Environment info

  • WordPress 5.8.2, Gutenberg trunk

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

@jffng jffng added the [Type] Bug An existing feature does not function as intended label Dec 10, 2021
@kjellr kjellr added the [Type] Regression Related to a regression in the latest release label Dec 10, 2021
@kjellr
Copy link
Contributor

kjellr commented Dec 10, 2021

cc @noisysocks so we can make sure this regression doesn't make it into the next Beta. 😅

@youknowriad
Copy link
Contributor

@oandregal could this be related to the recent change to how we load styles?

@oandregal
Copy link
Member

Yeah, it looks like #36851 introduced this regression.

From a quick glance, the thing that previews and block patterns have in common is that they're rendered within an iframe. It makes sense that #36851 introduced this regression because it changed how some styles (the global styles presets) were loaded.

I presume the fix is to also load the preset vars within the styles key of the block editor settings, in addition to the other method.

@oandregal
Copy link
Member

Got a potential fix at #37296

@oandregal oandregal self-assigned this Dec 10, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 10, 2021
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 [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants