Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chvillanuevap opened this issue Jun 26, 2023 · 3 comments · Fixed by #52661
Closed

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

chvillanuevap opened this issue Jun 26, 2023 · 3 comments · Fixed by #52661
Assignees
Labels
[Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@chvillanuevap
Copy link

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

@ndiego ndiego added Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Jun 27, 2023
@ndiego
Copy link
Member

ndiego commented Jun 27, 2023

Thanks for reporting @chvillanuevap, I am able to confirm. This might be related to #51619. I am going to add this to the 6.3 Project Board so it is properly assessed before the WordPress 6.3 release.

@ndiego ndiego moved this to 📥 Todo in WordPress 6.3.x Editor Tasks Jun 27, 2023
@ndiego ndiego added the [Type] Regression Related to a regression in the latest release label Jul 5, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 16, 2023
@t-hamano t-hamano moved this from 📥 Todo to 🏗️ In Progress in WordPress 6.3.x Editor Tasks Jul 16, 2023
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Done in WordPress 6.3.x Editor Tasks Jul 18, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jul 24, 2023
@chvillanuevap
Copy link
Author

This remains broken in Gutenberg 16.5 and also in WordPress core (version 6.3, no Gutenberg) Now the drop-down menu for custom padding/margin levels won't let me select a different value. Same steps as above to reproduce.

@chvillanuevap
Copy link
Author

Could it be because of repeated values in the custom sizes? I have:

{
	"name": "4.00rem (64px)",
	"slug": "400rem",
	"size": "4rem"
}, 
...

{
	"name": "9",
	"slug": "90",
	"size": "4rem"
}

Different slugs but same size. I do this for legacy reasons to not have to replace a bunch of CSS variables all over the place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants