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

Iframe: Stylesheet was not properly added error #34333

Closed
2 tasks done
renatho opened this issue Aug 26, 2021 · 5 comments
Closed
2 tasks done

Iframe: Stylesheet was not properly added error #34333

renatho opened this issue Aug 26, 2021 · 5 comments
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability CSS Styling Related to editor and front end styles, CSS-specific issues. [Package] Block editor /packages/block-editor

Comments

@renatho
Copy link
Contributor

renatho commented Aug 26, 2021

Description

In the latest version of Gutenberg, I started receiving an error in the console. It was introduced here: https://github.com/WordPress/gutenberg/pull/31870/files#diff-ab17abd38e687edd56573694ae3017e105e96b319571c190e9d4705c1872bc9cR58

Basically, the error is happening every time I select a block that contains the iframe to the sidebar, and this block enqueues styles through the following hooks: enqueue_block_assets / enqueue_block_editor_assets.

Since it's something new and we need backward compatibility in plugins, I wonder if it should be just a deprecation warning instead of an error. Or is there any other approach we could use for older WP versions along with the new approach?

Also, if we have styles shared between different blocks, how could we do that? Should editorStyle and style support arrays?

Step-by-step reproduction instructions

  1. Add a hook (enqueue_block_assets or enqueue_block_editor_assets) to enqueue styles.
  2. Go to the editor.
  3. Open the browser console.
  4. Select a block which contains styles (to have the iframe in the sidebar with the thumbnail for the different styles).

Screenshots, screen recording, code snippet

Screen Shot 2021-08-26 at 11 44 09

Environment info

  • WordPress 5.8 / Gutenberg 11.3.0 / Chrome or Firefox

Pre-checks

  • I have searched the existing issues.
  • I have tested with all plugins deactivated except Gutenberg.
@CreativeDive
Copy link
Contributor

CreativeDive commented Sep 6, 2021

I can confirm, I get the same error messages by using the "enqueue_block_editor_assets" action.

In my case I have global block styles, which are not block specific.

Why this error messages are added with the latest release?

@bph bph added Backwards Compatibility Issues or PRs that impact backwards compatability CSS Styling Related to editor and front end styles, CSS-specific issues. labels Sep 6, 2021
@richtabor
Copy link
Member

I've run into this as well.

@CreativeDive
Copy link
Contributor

CreativeDive commented Sep 7, 2021

@bph is this issue only related to "Backwards Compatibility" and "CSS Styling"? For me it sounds like wrong error messages.

This error message are also fired by styles which are included by admin_enqueue_scripts. But this styles are only related to the admin screen, not block related. It seems there is something wrong with this block styles check.

And on the other hand, the block style check should not fire on styles which are included with enqueue_block_editor_assets, because this action is allowed to load block editor styles.

@ellatrix
Copy link
Member

Is this still an issue after WP 6.3? For more info on styles in the iframe, see https://make.wordpress.org/core/2023/07/18/miscellaneous-editor-changes-in-wordpress-6-3/#post-editor-iframed.

@ellatrix ellatrix changed the title Stylesheet was not properly added error Iframe: Stylesheet was not properly added error Aug 16, 2023
@ellatrix ellatrix added the [Package] Block editor /packages/block-editor label Aug 16, 2023
@renatho
Copy link
Contributor Author

renatho commented Sep 4, 2023

Hi @ellatrix! I just checked it on a site with WP 6.3, and I couldn't see the error anymore. So I'm closing this issue.
Thank you!

@renatho renatho closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability CSS Styling Related to editor and front end styles, CSS-specific issues. [Package] Block editor /packages/block-editor
Projects
None yet
Development

No branches or pull requests

5 participants