-
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
Border Radius Control: Fix undefined value on first click into RangeControl #35651
Border Radius Control: Fix undefined value on first click into RangeControl #35651
Conversation
Size Change: +1 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
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.
Thanks for very quick debugging and fix @andrewserong 🏅
I could replicate the issue as described and after applying this PR branch and following the test instructions the issue has been fixed.
I'd like to suggest a small alternative option. We could just add the fallback to where unit
is first calculated. This would also allow the max
value to work properly as well in the case where the unit
is missing.
const unit = getAllUnit( values ) || 'px';
What do you think?
Oh, good catch, thanks @aaronrobertshaw! I've just pushed this change. |
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.
I've re-tested this.
The fix works. Adjusting the max value for the slider and px
units works as well.
LGTM 👍
We should be able to merge as soon as tests pass.
Thanks @andrewserong and @aaronrobertshaw for the fix ❤️ I was wondering if we could add some (unit) test coverage for added stability (to avoid e.g. people wanting to change the default from Would it make sense to maybe move the |
That's a great idea @ockham, thanks for suggesting it. Now that this fix is in, I'm happy to look into that as a follow-up next week to tidy it up and improve stability. I'll add it to my list! |
Thanks @andrewserong, sounds great! 😄 |
I've added a follow-up PR that includes unit tests for the |
Description
Fixes #35628
As reported by @ockham, in blocks that opt-in to the border radius control, if you click to set a border radius using the
RangelControl
(the slider) from a fresh state where there isn't already a value, then the value in the code editor view will appendundefined
to the end of the value, instead of a fallback default unit that we'd expect (px
).This PR updates the border radius control's
handleSliderChange
method to treat the current unit aspx
if a unit is not currently set.How has this been tested?
Manually in the editor.
px
value (beforehand, you'd see a value like41undefined
whereas now it should be41px
)Smoke test that this change doesn't affect switching between units, or the behaviour of the UnitControl.
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).