-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix error in with handling spacing preset slugs #43237
Conversation
…int, and parse int when converting from preset var to range control value
Size Change: -38.3 kB (-3%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
Will fix the broken unit tests tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic looks good to me here, @glendaviesnz, and good idea to treat the slugs as strings 👍
✅ Confirmed that the issue exists on trunk using string based slugs in specified spacingSizes
✅ This PR resolves the issue in both the post and site editors, and without providing the spacingSizes
the spacingScales
rules still work correctly (tested with steps set to 0
, 7
, and 10
).
LGTM! ✨
What?
Update theme.json spacing presets slugs to be compared as strings in the presets UI
Why?
The theme.json schema specified slugs as strings, which is a more standard format, in some places they were being compared as ints. Although the default format of 10,20,30 etc for slugs was decided on to allow for fallback to nearest values in a future iteration the slugs can be parsed to ints at that point so can be left as a string format elsewhere.
Fixes: #43234
How?
Update the generated spacingSizes slug values to be strings.
Testing Instructions
Add spacing.spacingSizes to a theme.json file with string slugs, eg:
Screenshots or screencast
Before:
After:
int-bug-after.mp4