Skip to content

Custom spacing sizes do not work properly after latest update #51891

@chvillanuevap

Description

@chvillanuevap

Description

I have custom spacing sizes in my theme.json:

{
    "settings": {
        "spacing": {
            "spacingSizes": [
                {
                    "name": "6",
                    "slug": "60",
                    "size": "2rem"
                },
                ...
            ]
        }
    }
}

When I add these custom spacing sizes to a group in the block editor, the frontend displays them as:

<div class="wp-block-group alignwide bricksy-travel-two-column-text has-global-padding is-layout-constrained wp-block-group-is-layout-constrained" style="padding-top:2rem;padding-right:var(--wp--preset--spacing--60);padding-bottom:2rem;padding-left:var(--wp--preset--spacing--60)">

For the top and bottom, it converts them to their actual units, while it keeps the variables from the right and left properties. The order here is dependent on which size I set first in the editor. Sometimes I get the actual units for the left and right. This is a new behavior that I noticed after updating the plugin.

Step-by-step reproduction instructions

  1. Update to latest version of Gutenberg.
  2. Add custom spacing sizes to theme.json.
  3. Add group block in block editor and add padding using custom spacing sizes.
  4. See the display on the frontend.

Screenshots, screen recording, code snippet

Screen Shot 2023-06-25 at 11 54 17 PM Screen Shot 2023-06-25 at 11 54 04 PM

Environment info

  • WordPress 6.2.2
  • Gutenberg 16.0.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

Labels

[Type] BugAn existing feature does not function as intended[Type] RegressionRelated to a regression in the latest release

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions