Skip to content

theme.json styles.blocks.core/heading values take precedence over styles.elements.h1 #39698

@pbking

Description

@pbking

Description

When values are provided in both
styles.blocks.core/heading and styles.elements.h1 the values provided in the "blocks" portion are leveraged rather than the "blocks" section.

It would be helpful to be able to style all of the "common" things in the headings in the styles.blocks portion of theme.json while tweaking only some of those values in styles.elements.

For instance, define a font-family used in MOST headers, but override that value for H5 and H6 to use a different font-family. As it stands to accomplish this the font-family must NOT be defined in styles.blocks (once) but instead exclusively defined in styles.elements (for every h element).

Step-by-step reproduction instructions

Use the following theme.json (or similar) in a theme:

{
  "settings": {
    "blocks": {
      "core/heading": {
        "color": {
          "text": "blue"
        }
      }
    },
    "elements": {
      "h1": {
        "color": {
          "text": "red"
        }
      }
    }
}

Render a header block. Note that the color is BLUE while the expected value would be RED.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions