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

Assembler: Unset white background (try 2) #89381

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

taipeicoder
Copy link
Contributor

@taipeicoder taipeicoder commented Apr 10, 2024

Fixes #89324

Proposed Changes

This PR fixes the issue where the background colors from global styles are not applied in the block renderer in the Assembler. This is caused by https://github.com/WordPress/gutenberg/pull/59377/files, where the background is explicitly set to white.

I don't feel great about this approach due to the performance penalties and that we are imposing CSS specificity, but since it's a short-term solution, I think it's okay we'll just remove it at a later date.

Note that the issue only affects Safari.

Testing Instructions

  • Using Safari, head to the Assembler.
  • Select some patterns, then styles.
  • Ensure that the background color from the global styles is applied correctly to the pattern in the large preview.
  • Ensure that Chrome and Safari also works as before.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • https://wpcalypso.wordpress.com/devdocs/docs/testing/index.md for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/block-renderer-white-background on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Apr 10, 2024

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~306 bytes added 📈 [gzipped])

name         parsed_size           gzip_size
patterns          +379 B  (+0.0%)     +160 B  (+0.0%)
import-flow       +379 B  (+0.0%)     +146 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@taipeicoder taipeicoder marked this pull request as ready for review April 10, 2024 02:16
@taipeicoder taipeicoder requested a review from a team April 10, 2024 02:17
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 10, 2024
@taipeicoder taipeicoder self-assigned this Apr 10, 2024
Copy link
Contributor

@arthur791004 arthur791004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and looks good to me 👍

How about removing the style from the head element and re-adding them like the previous approach?

@taipeicoder
Copy link
Contributor Author

Tested and looks good to me 👍

How about removing the style from the head element and re-adding them like the previous approach?

In the previous approach I had to use background-color: unset !important, but then it would be the same issue since the global styles CSS still doesn't enough specificity over the background-color: unset !important 🙁
Simply using background-color: unset without the !important part doesn't fix the specificity issue in Safari.

This also causes a regression issue where the pattern list preview would not have the background color applied.

Another approach we could do is to use JavaScript to remove the <style> injected by the Iframe component then re-add it, but I think the solution is not great either. WDTY?

@arthur791004
Copy link
Contributor

Another approach we could do is to use JavaScript to remove the <style> injected by the Iframe component then re-add it, but I think the solution is not great either. WDTY?

This is what I mean 😆 I'm fine with both and I assume it could be resolved after upgrading the package soon!

@taipeicoder
Copy link
Contributor Author

Let's merge this quick fix first, and we can time-box the other proposed solution 🙂

@taipeicoder taipeicoder merged commit 8e8a98f into trunk Apr 10, 2024
14 checks passed
@taipeicoder taipeicoder deleted the fix/block-renderer-white-background branch April 10, 2024 05:17
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assembler color styles are not applied properly within Safari
3 participants