-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Large list of spacing sizes causes var:preset|spacing|default value for other dimensions #52976
Description
Description
If a theme has more than 8 spacing size presets, when customizing a dimension for margin, padding or block gap in the block editor for a block, the other non-customized dimensions for that "dimension group" will have a value of var:preset|spacing|default which for most themes will not exist.
8 is the threshold for whether <SpacingInputControl> displays a range control or a dropdown control:
It seems likely then that it could be a bug with the way the dropdown control is used to handle the default value.
Step-by-step reproduction instructions
- Edit
wp-content/themes/twentytwentythree/theme.jsonto add 3 extra members insettings.spacing.spacingSizes:"slug": "80", "name": "6" + }, + { + "size": "1rem", + "slug": "foo", + "name": "foo" + }, + { + "size": "2rem", + "slug": "bar", + "name": "bar" + }, + { + "size": "3rem", + "slug": "baz", + "name": "baz" } ], "units": [ "%",
- Enable Twenty Twenty-Three theme.
- Go into the Site Editor and edit the Footer template part.
- Edit the top padding of the top level
core/groupblock. - See that the left and right dimensions now lose their global padding and instead have the invalid
var:preset|spacing|defaultvalue.
Screenshots, screen recording, code snippet
✅ With 8 or less spacing sizes
The other padding dimensions are not set when editing the top padding (commented formatted for readability):
<!-- wp:group {
"style":{
"spacing":{
"padding":{
"top":"var:preset|spacing|40"
}
}
},
"layout":{"type":"constrained"}
} -->
❌ With more than 9 spacing sizes
The other padding dimensions are set to var:preset|spacing|default when editing the top padding (commented formatted for readability):
<!-- wp:group {
"style":{
"spacing":{
"padding":{
"top":"var:preset|spacing|40",
"right":"var:preset|spacing|default",
"bottom":"var:preset|spacing|default",
"left":"var:preset|spacing|default"
}
}
},
"layout":{"type":"constrained"}
} -->
Environment info
WordPress 6.3-RC2-56310
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

