Description
Description
Before 6.3 update, I used the spacer block with 4 block variations for preset sizes (with a js filter). But, when I updated to 6.3 it showed the spacing.spacingSizes that I had specified for gaps & margin! Super nice!
I was very happy to see that these are now used for the spacer block. At least... I thought so. Because, after I removed all the variations and worked on some other things, the spacer presets are gone again.
For some reason, the spacer blocks that existed before 6.2 and after updating to 6.3 did have the presets. But, adding a new spacer block does not have the presets.
Looking at the source code of the block I see that spacing.spacingSizes is actually retrieved.
But somehow they are not working! I have tried setting the spacingSizes specifically on settings.blocks.core/spacer
This is how I load variables in theme.json (the supplied var(--spacing--token--1) are processed with media queries, this has never given me issues before).
"spacing": {
"blockGap": true,
"units": [
"%",
"px",
"rem"
],
"customSpacingSize": false,
"spacingScale": {
"steps": 0
},
"spacingSizes": [
{
"size": "var(--spacing--token--1)",
"slug": "1",
"name": "1"
},
{
"size": "var(--spacing--token--2)",
"slug": "2",
"name": "2"
},
{
"size": "var(--spacing--token--3)",
"slug": "3",
"name": "3"
},
{
"size": "var(--spacing--token--4)",
"slug": "4",
"name": "4"
},
{
"size": "var(--spacing--token--5)",
"slug": "5",
"name": "5"
}
]
}
Step-by-step reproduction instructions
I suppose:
- Add spacer blocks to a WP 6.2 site
- Add settings.spacing.spacingSizes (2-3 presets will do)
- Inspect the spacer blocks (no preset tokens)
- Update WP to 6.3
- Inspect the spacer blocks (do they have preset tokens or not?) -- in my case YES
- Remove the spacer block. Add a new one.
- Inspect the spacer blocks (do they have preset tokens or not?) -- in my case NO
Screenshots, screen recording, code snippet
Edit: I found another theme that was still in 6.2 and can now demonstrate this weird behavior, just after update to 6.3:
Environment info
- WordPress 6.3(.1)
- No gutenberg plugin
- Default TT3 theme with customized theme.json
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