Making WordPress.org

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#8222 closed defect (bug) (reported-upstream)

Properly enqueue block style_handles in pattern editor

Reported by: bor0 Owned by:
Priority: normal Milestone:
Component: Pattern Directory Keywords: has-patch
Cc:

Description

The function _wp_get_iframed_editor_assets enqueues editor_style_handles, but not style_handles.

In the admin editor, frontend styles are already on the page, so this works. In a frontend block editor (e.g. Pattern Creator), they are never loaded, breaking blocks like Cover that rely on them for canvas layout/background CSS.

Additionally, __unstableIframe dropped its head prop in Gutenberg 22.x, preventing EditorStyles from injecting theme styles into the canvas (fonts, CSS custom properties, etc.).

The proposed patch here carries workarounds for both:

  • PHP: hooks into enqueue_block_assets to enqueue style_handles inside the capture window
  • JS: moves EditorStyles from the head prop to a child of Iframe

Attachments (3)

8222.patch (80.7 KB ) - added by bor0 5 months ago.
Screenshot 2026-04-06 at 14.52.37.png (319.7 KB ) - added by bor0 5 months ago.
Frontend with patch applied (no visual changes)
Screenshot 2026-04-06 at 14.52.41.png (286.5 KB ) - added by bor0 5 months ago.
Backend with patch applied (styles are properly attached, visually looks like frontend)

Download all attachments as: .zip

Change History (7)

@bor0
5 months ago

@bor0
5 months ago

Frontend with patch applied (no visual changes)

@bor0
5 months ago

Backend with patch applied (styles are properly attached, visually looks like frontend)

#1 @bor0
5 months ago

cc @dd32 for another one, would appreciate your input

This ticket was mentioned in Slack in #meta by jonsurrell. View the logs.


5 months ago

#3 @dd32
5 months ago

  • Component GeneralPattern Directory
  • Resolutionreported-upstream
  • Status newclosed

@bor0 Please check you select the correct component, as in this case it'd redirect you to the Github source where you can PR it :) https://github.com/WordPress/pattern-directory/pulls

Last edited 5 months ago by dd32 (previous) (diff)
Note: See TracTickets for help on using tickets.