Skip to content

Theme.json - styles.blocks.core/button.spacing.padding doesn't apply if button uses Outline style #35438

@chrisbellboy

Description

@chrisbellboy

Description

Hey everyone,

Was playing around with the theme.json and noticed that if you set styles.blocks.core/button.spacing.padding.X and styles.blocks.core/button.border.X values in the theme.json - they work fine except when you set the outline style to the button, as this style triggers higher specificity css on the frontend. This only applies to the frontend, as the editor adds even higher specificity.

The only "workaround" I could find was to add !important to the theme.json padding values, but of course... 🤢

Step-by-step reproduction instructions

  1. Add a value to: styles.blocks.core/button.spacing.padding.left
  2. Add two buttons in the editor. Set one to Outline style.
  3. Save and check the frontend

Screenshots, screen recording, code snippet

image

Environment info

Gutenberg 11.6.0

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

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] ButtonsAffects the Buttons Block[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