Skip to content

Block assets have more CSS than expected when Gutenberg is enabled #39393

@oandregal

Description

@oandregal

Description

See full report at #38712 (comment)

For themes that have should_load_separate_block_assets enabled, the styles for blocks are loaded as separate embedded stylesheets. The expected content of every stylesheet is the contents of the style.css of the block and, optionally, if the theme opts-in, the theme.css as well.

However, when Gutenberg is active, the block stylesheet has more contents than expected.

Step-by-step reproduction instructions

  • Use WordPress 5.9.X with the Gutenberg plugin active.
  • Use a block theme (by default they have should_load_separate_block_assets enabled).
  • Go to the front-end and inspect the wp-block-group-inline-css. It contains:
.wp-block-group {
  box-sizing: border-box;
}
:where(.wp-block-group.has-background) {
  padding: 1.25em 2.375em;
}
.wp-block-group:where(.has-background) {
  padding: 1.25em 2.375em;
}

However, when Gutenberg is not enabled it instead outputs:

.wp-block-group {
  box-sizing: border-box;
}

.wp-block-group:where(.has-background) {
  padding: 1.25em 2.375em;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    CSS StylingRelated to editor and front end styles, CSS-specific issues.[Feature] BlocksOverall functionality of blocks[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions