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

Spacing: Spacing Sizes are added #55636

Closed
hanneslsm opened this issue Oct 26, 2023 · 8 comments · Fixed by #61842
Closed

Spacing: Spacing Sizes are added #55636

hanneslsm opened this issue Oct 26, 2023 · 8 comments · Fixed by #61842
Labels
Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@hanneslsm
Copy link

Description

Spacing sizes are getting added to the list, even though I have defined different ones in my theme.
This seems to happen to any theme that does not have 1, 2, 3… defined as spacing size.

Step-by-step reproduction instructions

  1. Select a theme with custom spacing sizes
  2. Wonder where the new spacing sizes are coming from

Screenshots, screen recording, code snippet

image

Environment info

  • WP 6.4-RC2
  • GB 16.9.0

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

No

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

No

@jordesign jordesign added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. [Feature] Typography Font and typography-related issues and PRs labels Oct 26, 2023
@hanneslsm
Copy link
Author

hanneslsm commented Oct 26, 2023

i thought maybe i could get around the problem by using 1,2,3... as a slug, but that doesn't change anything either.
image

Edit: Just saw that TT4 used 10 as a slug for 1. The bug still exists with 10 as slug.

@bgardner
Copy link

bgardner commented Oct 26, 2023

I can confirm this is happening. My Powder theme sets Spacing presets (xSmall, Small, Medium, Large, xLarge) with the following, but numbers are being added per the video below. The slider no longer exists, rather a drop down menu.

"spacing": {
	"spacingSizes": [
		{
			"name": "xSmall",
			"size": "20px",
			"slug": "x-small"
		},
		{
			"name": "Small",
			"size": "clamp(30px, 4vw, 40px)",
			"slug": "small"
		},
		{
			"name": "Medium",
			"size": "clamp(40px, 6vw, 60px)",
			"slug": "medium"
		},
		{
			"name": "Large",
			"size": "clamp(50px, 8vw, 80px)",
			"slug": "large"
		},
		{
			"name": "xLarge",
			"size": "clamp(60px, 10vw, 100px)",
			"slug": "x-large"
		}
	],
	"units": [ "%", "px", "em", "rem", "vh", "vw" ]
}
Screen.Recording.2023-10-26.at.1.16.00.PM.mov
@carolinan carolinan removed the [Feature] Typography Font and typography-related issues and PRs label Oct 30, 2023
@carolinan
Copy link
Contributor

carolinan commented Oct 30, 2023

From the screenshot of theme.json, It does not look like you have disabled the default sizes by adding

			"spacingScale": {
				"steps": 0
			},

Do I understand correctly that you are experiencing that this is a change from previous WP or Gutenberg versions?

@hanneslsm
Copy link
Author

Thanks @carolinan - this has solved the issue!

Do I understand correctly that you are experiencing that this is a change from previous WP or Gutenberg versions?

Yes, defining the spacingScale was not necessary in previous versions. I leave this issue open to clarify if this is intended or a bug.

@carolinan
Copy link
Contributor

I would expect the disabling to use the same format as colors:

			"defaultDuotone": false,
			"defaultPalette": false,
			"defaultGradients": false,
@bgardner
Copy link

@carolinan Thanks for calling that out. I’ll have to go back to my commits in Powder because I swear I had that code in my theme.json file. Nonetheless, I have added it to the theme and no longer am experiencing the issue.

@dabowman
Copy link

Just bumping this. I noticed the same thing. a boolean to toggle off the default spacing scale would be excellent. maybe settings.spacing.defaultScale to follow the pattern from the color object.

@carolinan
Copy link
Contributor

I am no longer able to reproduce this.
When a theme adds its own spacing sizes, with or without editing the spacing scale, then the default sizes are not added.
Also see #60129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
5 participants