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 stylesheets are not cloned in Firefox #37961

Closed
miguelpeixe opened this issue Jan 13, 2022 · 3 comments
Closed

Iframe stylesheets are not cloned in Firefox #37961

miguelpeixe opened this issue Jan 13, 2022 · 3 comments
Assignees
Labels
Browser Issues Issues or PRs that are related to browser specific problems [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@miguelpeixe
Copy link

Description

The styleSheetsCompat() strategy introduced by #25775 is not working properly on Firefox (tested in 96.0). It behaves as expected on Chrome and Safari

Step-by-step reproduction instructions

  1. Enqueue a style containing one of the keywords to match the cloning strategy (e.g.: .editor-styles-wrapper)
  2. Edit a post, toggle block inserter, click on "Patterns"
  3. Observe the style is applied to the main editor but not on the Patterns block previews

You can use the sample code below to compare the behavior on Chrome and Firefox

Screenshots, screen recording, code snippet

Sample plugin for testing:

styleSheetsCompat-ff-test.php

<?php
/**
 * Plugin name: styleSheetsCompat FF Test
 */
add_action( 'admin_init' , 'styleSheetsCompat_ff_css_iframe_clone_init' );
function styleSheetsCompat_ff_css_iframe_clone_init() {
  wp_enqueue_style( 'ff-css-iframe-clone', plugins_url( 'styleSheetsCompat-ff-test.css', __FILE__ ) );
}

styleSheetsCompat-ff-test.css

.editor-styles-wrapper {
  background: #f00 !important;
}

Environment info

  • WordPress 5.9 RC2
  • Gutenberg trunk
  • Firefox 96.0 on macOS 12.1

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

@tomusborne
Copy link

This seems to be an issue outside of the pattern block previews as well.

Themes and plugins that are still using enqueue_block_editor_assets instead of editorStyle or add_editor_style() (due to the lack of being able to add dynamic CSS using wp_add_inline_style()) are missing their styles in Firefox when using the tablet and mobile previews in the regular editor.

@miguelpeixe
Copy link
Author

miguelpeixe commented Feb 3, 2022

This seems to be an issue outside of the pattern block previews as well.

Yes, this bug will affect any compatible wp_enqueue_style() or wp_add_inline_style() for every iframed editor in Firefox.

@annezazu annezazu added [Type] Bug An existing feature does not function as intended Browser Issues Issues or PRs that are related to browser specific problems labels Feb 9, 2022
@ellatrix
Copy link
Member

I believe this was fixed in #40842. Please reopen if I'm mistaken. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser Issues Issues or PRs that are related to browser specific problems [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants