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

Spacer Block: Collapse when using inspector control #52880

Open
jasmussen opened this issue Jul 24, 2023 · 4 comments
Open

Spacer Block: Collapse when using inspector control #52880

jasmussen opened this issue Jul 24, 2023 · 4 comments
Labels
[Block] Spacer Affects the Spacer Block [Type] Bug An existing feature does not function as intended [Type] Question Questions about the design or development of the editor.

Comments

@jasmussen
Copy link
Contributor

If I add the following in theme.json,

		"spacing": {
			"customSpacingSize": true,
			"spacingScale": {
				"increment": 1.5,
				"mediumStep": 1.5,
				"operator": "*",
				"steps": 7,
				"unit": "rem"
			},
			"spacingSizes": [],
			"units": [
				"%",
				"px",
				"em",
				"rem",
				"vh",
				"vw"
			]
		},

then the spacer block collapses to a single pixel if using the inspector control:

spacer block inspector control, collapsing

Notably if I remove this line, it works with the new stepped control:

			"spacingSizes": [],

As shown here:

spacer block not collapsing when using inspector

It would seem that the crash happens when an empty array is passed to the spacing sizes. Is this incorrect theme.json usage, or should the control be able to handle it?

@jasmussen jasmussen added [Type] Bug An existing feature does not function as intended [Type] Question Questions about the design or development of the editor. labels Jul 24, 2023
@carolinan
Copy link
Contributor

What was the expected result from adding "spacingSizes": [],?

@jasmussen
Copy link
Contributor Author

To be honest, I don't know as I didn't work on the theme in question (called "Fewer") and I think I'll suggest removing that clause to improve the theme with spacing presets. It's an older block theme so it could have had an intended effect a while back which is no longer relevant.

@carolinan
Copy link
Contributor

🤔 It doesn't look like the intention was to remove the option since the custom spacing scale is added.

@Mamaduka Mamaduka added the [Block] Spacer Affects the Spacer Block label Jul 27, 2023
@grantgeard
Copy link

I am encountering the same bug when settings.spacing.spacingScale.steps is equal to zero. In this case, my intent is to remove the spacing scale option and this did work up until WordPress v6.3.0, so far as I know. Removing this setting adds the scale back to the UI and fixes the issue.

There is a similar bug with block gap as reported in issue #45827.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Spacer Affects the Spacer Block [Type] Bug An existing feature does not function as intended [Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

No branches or pull requests

4 participants