Theme: Fix layout style bleed from previews into main theme #514
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #513 — Any styles added via
gutenberg_get_layout_stylewill be added to the globalblock-supportsstore in the style engine (definitely new in GB 13.9, possibly from WordPress/gutenberg#42880). The pattern previews used to need a workaround to support layout width (see #428), which was generating the styles injected viawindow.__editorStyles. This function now also has a side effect of adding that rule to the main site too, which is breaking the admin bar.The fix added here is to use
entry-contentclass on the preview & thumbnail container divs, so that the theme & default styles are correctly applied. Then we can remove the call togutenberg_get_layout_style. Removing old workarounds 👍🏻Props kafleg, dd32
Screenshots
This also adds the block spacing between the groups ^ which matches the editor UI, so I think that's overall a good thing.
How to test the changes in this Pull Request: