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

wp_enqueue_block_style no longer adds styles in the site editor if Gutenberg 13.0 is active #40469

Closed
carolinan opened this issue Apr 20, 2022 · 13 comments · Fixed by #40842
Closed
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@carolinan
Copy link
Contributor

Description

In WordPress 5.9x, a block theme can use wp_enqueue_block_style to add additional stylesheets to blocks.

But when Gutenberg 13.0 is active, the styles are no longer applied in the site editor or template editor, only in the block editor and the front.

Step-by-step reproduction instructions

Activate a theme that uses wp_enqueue_block_style.

  1. In the site editor, add one of the styled blocks.
  2. Save and view the front.
  3. Compare the Site Editor and front and see that the styles do not match.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 5.9.3
Gutenberg 13.0

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

@carolinan
Copy link
Contributor Author

I confirmed that this is still happening with 6.0-beta2-53249 and current Gutenberg trunk.
Does not happen with 6.0-beta2-53249 only.
Does not happen on 6.0-beta2-53249 or 5.93 with Gutenberg 12.9.

Can someone confirm if this was an intentional change or a bug?
I don't know who to ask, @Mamaduka?

@carolinan carolinan added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Apr 25, 2022
@Mamaduka
Copy link
Member

Pinging @adamziel and @gziolo.

I’m offline today, but can have a look tomorrow.

@gziolo
Copy link
Member

gziolo commented Apr 25, 2022

Does not happen with 6.0-beta2-53249 only.

It doesn't look like it's an issue with WordPress core.

@Mamaduka Mamaduka added [Type] Regression Related to a regression in the latest release and removed [Type] Bug An existing feature does not function as intended labels Apr 26, 2022
@Mamaduka
Copy link
Member

I am marking this as a regression. I will try to debug the issue later this week.

@Mamaduka Mamaduka self-assigned this Apr 26, 2022
@Gierand
Copy link

Gierand commented May 2, 2022

@carolinan, @Mamaduka when enqueueing stylesheets via add_editor_style, they are also noticeably absent.

@ndiego
Copy link
Member

ndiego commented May 4, 2022

Just confirmed this no longer works in 6.0 RC1 (without Gutenberg active). I'm elevating this issue as it's a breaking change.

@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention labels May 4, 2022
@Mamaduka Mamaduka removed their assignment May 4, 2022
@ndiego
Copy link
Member

ndiego commented May 4, 2022

cc @annezazu @priethor @gziolo @adamziel Unfortunately, this is another one. It's a significant breaking change that we need to get fixed before the 6.0 release.

@gziolo
Copy link
Member

gziolo commented May 4, 2022

As noted in #40562 (comment). It must be something with passing styles to the iframed editor. The following sentence is a great confirmation of that:

But when Gutenberg 13.0 is active, the styles are no longer applied in the site editor or template editor, only in the block editor and the front.

@carolinan
Copy link
Contributor Author

Possibly related:
#40603

@ndiego
Copy link
Member

ndiego commented May 4, 2022

@carolinan yup, that looks to be the same issue. So it appears this was introduced in 13.0, I'm going to start going through the changelog there.

@carolinan
Copy link
Contributor Author

carolinan commented May 4, 2022

wp_enqueue_block_style uses enqueue_block_assets to add editor styles, Gutenberg active, I need to combine wp_enqueue_block_style with add_editor_style to add CSS to the site editor.

@carolinan
Copy link
Contributor Author

:/ OK adding add_editor_style no longer works with 6.0 Rc1. It did work in beta 2.

@gziolo
Copy link
Member

gziolo commented May 5, 2022

A potential fix is ready for testing: #40842.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants