-
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
Button: Properly handle border radius reset #23887
Button: Properly handle border radius reset #23887
Conversation
@njbrown Thank you for working on this! ❤️
@youknowriad I took a look. There's something odd about the reset mechanism of this component. I remember helping fix something There's also a Ideally, the consumer of this component shouldn't have to manually interpret change callbacks to manage resets. Digging through the closed issues.. the previous bug came from Looking at the previous implementation 🤔 It looks like the reset action caused As a next step, I'll observe and track issues related to For now, I think this update works. Does that sound good? Thanks! |
Yes, that sounds good to me. |
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.
🚀 Looks good to me! Thank you @njbrown !!
I left a note regarding better reset handling overall. It's not a blocker for this PR.
Approved!
Congratulations on your first merged pull request, @njbrown! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
setAttributes( { | ||
borderRadius: initialBorderRadius, | ||
} ); | ||
else setAttributes( { borderRadius: newBorderRadius } ); |
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.
It's weird that this passes the linting checks, I thought {}
were enforced.
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.
Oh, hmm 🤔
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.
Not a big deal, but if folks think it could be a good rule we can see if we should add it.
Description
When the reset button of the border radius slider is clicked, the button in the editor doesn't reflect the change. This bug exists because the
RangeControl
component passedundefined
to itsonChange
callback when the reset button is hit and this condition was not handled.This pr fixes it by capturing the initial value of the border radius of the button then resets to it to that value when the reset button is pressed.
How has this been tested?
Add a Button
Change the value of the border radius
Hit the reset button beside the border radius slider
Screenshots
before fix:

after fix:

Types of changes
Bug Fix
Checklist: