๐Ÿ’Ž PREMIUM: WordPress/gutenberg/pull/ - Full Archive

Skip to content

Conversation

@mikachan

What?

Closes #72776

An alternative fix to #72046

This makes the .has-background padding more specific to the heading block, rather than to the heading element tags (h1, h2, h3, etc), to prevent it from being applied to other blocks that use heading elements (e.g. the Accordion Heading).

Why?

To prevent these specific styles from being applied to other blocks, and allow other blocks to override padding via theme.json.

How?

Adds the .wp-block-heading class to the existing .has-background padding CSS rule. Also removes a previous fix for the Accordion Heading block that should no longer be required.

Testing Instructions

  1. Insert an Accordion block
  2. Apply a background to an Accordion Heading block
  3. Make sure that there is no additional padding applied in the editor or on the front end when the background color is applied
  4. Add the below theme.json snippet to your theme's theme.json file
  5. Ensure that the padding from theme.json is applied correctly to the Accordion Heading block

Example theme.json snippet:

"blocks": {
    "core/accordion-heading": {
        "spacing": {
            "padding": {
                "left": "0.3em",
                "right": "0.3em"
            }
        }
    }
}

Screenshots or screencast

Before After
image image