LetterSpacingControl: Filter out percentage unit from available units#70479
LetterSpacingControl: Filter out percentage unit from available units#70479Mayank-Tripathi32 wants to merge 2 commits intoWordPress:trunkfrom
Conversation
… for letter-spacing settings
… are not valid for letter-spacing according to CSS specification
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR.
percentage values are not valid CSS units for the
letter-spacingproperty
This may be a Chrome-specific bug, so we'd be cautious before moving forward with this PR.
See #70478 (comment)
|
Closing as the support for % is getting added slowly |
What?
Closes #70478
Remove percentage (%) unit option from letter-spacing typography control dropdown.
Why?
Users were seeing "%" as an available unit option in the letter-spacing typography control, but percentage values are not valid CSS units for the
letter-spacingproperty. When users selected percentage values, their letter-spacing settings would not work, causing confusion and frustration.The CSS
letter-spacingproperty accepts length values (px, em, rem, etc.) but not percentage values, making the percentage option misleading and non-functional.How?
Modified the
LetterSpacingControlcomponent to filter out the%unit from the available units before passing them to theuseCustomUnitshook. This follows the same pattern already used in the Spacer block control, which also filters out percentage units where they're not appropriate.The change:
availableUnitsarray to exclude%when units are provided from settingsTesting Instructions
Screenshots or screencast
After: Letter spacing dropdown excludes "%" option, showing only functional units