Making WordPress.org

Opened 6 weeks ago

Closed 6 weeks ago

Last modified 6 weeks ago

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

Properly enqueue block style_handles in pattern editor

Reported by: bor0's profile bor0 Owned by:
Milestone: Priority: normal
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 6 weeks ago.
Screenshot 2026-04-06 at 14.52.37.png (319.7 KB) - added by bor0 6 weeks ago.
Frontend with patch applied (no visual changes)
Screenshot 2026-04-06 at 14.52.41.png (286.5 KB) - added by bor0 6 weeks ago.
Backend with patch applied (styles are properly attached, visually looks like frontend)

Download all attachments as: .zip

Change History (7)

@bor0
6 weeks ago

@bor0
6 weeks ago

Frontend with patch applied (no visual changes)

@bor0
6 weeks ago

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

#1 @bor0
6 weeks ago

cc @dd32 for another one, would appreciate your input

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


6 weeks ago

#3 @dd32
6 weeks ago

  • Component changed from General to Pattern Directory
  • Resolution set to reported-upstream
  • Status changed from new to closed

@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 6 weeks ago by dd32 (previous) (diff)
Note: See TracTickets for help on using tickets.