-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
customSpacingSize broken in my theme #62194
Comments
Ping @MaggieCabrera @ajlende @ellatrix. And thanks @richtabor for your comment #61842 (comment). |
Similar report: #62195 |
Definitely a result of #61842. There are a couple things going on here that cause it. SortingThe sorting was added to resolve an issue with presets being out of size order when merging default presets, According to the documentation, the slugs should be in the format
Examples in the Theme Handbook also support this format. Expecting that folks may have wanted to include names, I made sure to allow strings like I should have assumed that other slugs would be added since none of the other presets have this requirement and it wasn't enforced in the code anywhere. It's one thing to have out of order named sizes in the dropdown, but it's definitely a problem in the slider with renaming applied. NamingThe renaming in the UI to numbers in the slider was also to fix an issue of merging presets. With the merged presets, you'd end up with duplicate and incorrectly ordered numbers because the numbers didn't correspond to the slugs. You could have a generated preset with the The generated t-shirt sizes for names didn't have this problem because The PR where names were switched to numbers was #44247 and there was some discussion in #44133 (comment) also that I found. Since those discussions were about the UI, it seemed safe to move the renames to the UI so that proper names could be used elsewhere in the UI if we wanted. I think saw some mock-ups with names listed above the slider, but I can't seem to find it right now. SolutionsUnfortunately at this point in the code, there isn't any way of knowing which version of the theme.json the source is coming from, so the solution that we come up with to make v2 work also has to work for the merged sizes in v3. In the JS, we also don't have access to the The best solution I can come up with is sorting the merge of Are there other considerations I'm missing with that solution? Do you think that would satisfactorily solve the problem? |
Description
Likely as a result of #61842, my custom spacing sizes are no longer working. My Powder theme (https://github.com/bgardner/powder/blob/main/theme.json#L146) uses t-shirt sizing method, per below (note my theme.json is currently
"version": 2
With Gutenberg 18.5 RC1 active, numbers are now being used in areas such as padding, and the mapping is out of order:
1 = var(--wp--preset--spacing--large)
2 = var(--wp--preset--spacing--medium)
3 = var(--wp--preset--spacing--small)
4 = var(--wp--preset--spacing--x-large)
5= var(--wp--preset--spacing--x-small)
It appears my t-shirt sizing presets are being reordered by alpha in this scale. Expected behavior/output should be:
xSmall= var(--wp--preset--spacing--x-small)
Small = var(--wp--preset--spacing--small)
Medium = var(--wp--preset--spacing--medium)
Large = var(--wp--preset--spacing--large)
xLarge = var(--wp--preset--spacing--x-large)
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Below is a before/after video of me applying padding to a group block. First instance is with WP 6.5.3 (Gutenberg not active) and the second instance is with WP 6.5.3 (Gutenberg 18.5 RC1 active)
Screen.Recording.2024-05-31.at.1.50.59.PM.mp4
Environment info
WordPress 6.5.3, Gutenberg 18.5 RC1
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
The text was updated successfully, but these errors were encountered: