#58605 closed defect (bug) (fixed)
Core block editor styles registered with frontend stylesheet URL instead of editor stylesheet URL
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
While taking a closer look at the register_block_style_handle()
function for #58528, I noticed that all core block editor style handles (i.e. wp-block-{$block_name}-editor
) are registered pointing to the frontend stylesheet (style.css
) rather than the editor stylesheet (editor.css
). This happens because the style.css
file name is hard-coded in the function regardless of whether the style
or editorStyle
is being registered.
Effectively, right now every pair of wp-block-{$block_name}
and wp-block-{$block_name}-editor
handles uses the same stylesheet file, which looks wrong given that several of them have dedicated editor stylesheets.
Looking at the Gutenberg plugin, it appears to work correctly there since Gutenberg has a dedicated logic path for editor styles, see https://github.com/WordPress/gutenberg/blob/3a419b840da0117ea05925c994861919acbe0c3d/lib/blocks.php#L277. So this is specifically a WordPress core bug that we should fix.
Adding this to the 6.3 milestone for consideration.
Change History (5)
This ticket was mentioned in Slack in #core-editor by flixos90. View the logs.
19 months ago
This ticket was mentioned in PR #4679 on WordPress/wordpress-develop by @flixos90.
19 months ago
#2
- Keywords has-patch has-unit-tests added; needs-patch removed
#3
@
19 months ago
- Owner set to flixos90
- Status changed from new to assigned
PR https://github.com/WordPress/wordpress-develop/pull/4679 is ready for review.
It fixes the bug and adds test coverage for the core block-specific behavior, which was missing before. The tests ensure that the bug is fixed as intended.
@flixos90 commented on PR #4679:
19 months ago
#5
Committed in https://core.trac.wordpress.org/changeset/56005.
Trac ticket: https://core.trac.wordpress.org/ticket/58605
This PR also includes test coverage for the core-specific code paths of
register_block_style_handle()
which was missing before.