-
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
Fixed: Dimensions Custom Unit behaviour is not working as expected #68740
base: trunk
Are you sure you want to change the base?
Fixed: Dimensions Custom Unit behaviour is not working as expected #68740
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
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. |
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.
While I haven’t tested this, I trust it fixes the issue yet I doubt that changing code in UnitControl
is the best approach. That’s because I’ve tested another component BoxControl
that also pairs UnitControl
with a range input and it doesn’t have the same issue.
Here’s a quick demo trying to reproduce the issue in the BoxControl
story:
box-control-empty-non-px-unit-and-range-drag.mp4
That leads me to think the issue is somewhere in SpacingSizesControl
. Would you agree?
@stokesman Agreed, I was initially under impression that it was present across all related component and tried to fix the root cause, I will check |
fixes #68734
What?
The issue occurs when changing the typography dimensions (e.g., padding/margin) from "Use size preset" to "Set Custom Size" and switching the unit type from px to another unit. The selected unit resets back to px, requiring users to select their desired unit twice.
Why?
How?
The fix ensures the selected unit is preserved during the transition by improving the logic inside the getValidParsedQuantityAndUnit function:
Testing Instructions
Screencast
Screen.Recording.2025-01-17.at.4.24.55.PM.mov