Make WordPress Core

Opened 6 months ago

Last modified 5 months ago

#59896 new defect (bug)

Block editor default styles not loaded when stylesheet with the same name as the theme is registered

Reported by: kingkool68's profile kingkool68 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 6.4
Component: Editor Keywords: reporter-feedback
Focuses: Cc:

Description

I've got a custom theme that lives in a directory called "coderpad". Inside the theme I load a custom stylesheet with the handle "coderpad" which is registered via the "init" hook and enqueued via the "wp_enqueue_scripts" hook. I don't load any sort of custom editor styles as part of this theme.

After upgrading to WordPress 6.4 the block editor fails to load any default styles. The content in the editor looks like a big wall of text without any formatting. My simple workaround is to only register the stylesheet when it's not an admin request:

if ( ! is_admin() ) {
    wp_register_style(
        'coderpad',
	get_template_directory_uri() . '/assets/css/coderpad.min.css',
	array(),
	null,
	'all'
    );
}

This issue also appears to not happen if I rename the stylesheet handle to something like "coderpad-foo"

Here are two screenshots of what is happening: https://imgur.com/a/kgKkrmw

I'm not sure if there is logic somewhere that detects if a stylesheet with the same handle as the theme directory is registered then don't load default styles but thought I would post about this unexpected behavior.

Attachments (1)

59896.diff (1.1 KB) - added by jorbin 6 months ago.

Download all attachments as: .zip

Change History (5)

@jorbin
6 months ago

#1 @jorbin
6 months ago

  • Keywords reporter-feedback added

Thanks for the report @kingkool68. I'm trying to reproduce this and I tried using the twentyfifteen theme with the modifications in https://core.trac.wordpress.org/attachment/ticket/59896/59896.diff but I'm not able to replicate this.

Are you able to supply a patch to one of the default themes that demonstrates this? I also wonder if perhaps you are using register_theme_directory and this is related to #59847?

#2 @kingkool68
6 months ago

register_theme_directory is not used in my theme or any plugins on my site. Will try and see if I can replicate this with a default theme.

This ticket was mentioned in Slack in #core by jorbin. View the logs.


5 months ago

#4 @jorbin
5 months ago

  • Milestone changed from Awaiting Review to Future Release

Noting here that this still needs a test case to demonstrate it. It also could use some further testing after [57129] restored the pre-6.4 theme loading (on the chance that this was a side effect of the caching)

Moving to Future Release until there is more info to go over.

Note: See TracTickets for help on using tickets.