-
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
Image block: fix image size control percentage selection #49628
Conversation
Size Change: +59 B (0%) Total Size: 1.35 MB
ℹ️ View Unchanged
|
Flaky tests detected in c327aa8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4626222574
|
…with the callback value and not the state value
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.
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.
Also the case on trunk, so LGTM here.
What?
Fixes a small issue in the image block where the percentage sizes were not selected correctly when the user adjusts sizes using the number controls.
How?
The issue is that when using the number controls, the sizes were being stored as a string, while they are usually a number.
The component does this check to see if the current size matches the percentage presets:
It was failing because
string
!==number
.The best fix seems to be to consistently store values as numbers, so that's what I've done here.
Testing Instructions
In trunk: Observe that 100% doesn't become re-selected
In this branch: 100% should become reselected
Screenshots or screencast
Before
After