-
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
BorderControl: always show clear button #69066
base: trunk
Are you sure you want to change the base?
BorderControl: always show clear button #69066
Conversation
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. |
@@ -147,6 +147,12 @@ export const borderControlPopoverControls = css` | |||
export const borderControlPopoverContent = css``; | |||
export const borderColorIndicator = css``; | |||
|
|||
export const clearButton = css` |
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.
Reference
.components-circular-option-picker__custom-clear-wrapper { | |
display: flex; | |
justify-content: flex-end; | |
margin-top: $grid-unit-15; | |
} |
cc @WordPress/gutenberg-components |
Thank you for the ping! Here are a few thoughts:
What do y'all think? |
I think this is a very good idea. If it's okay to always display the reset button, I'll delete the |
Thank you. I adjusted it.😌 |
<div className={ clearButtonClassName }> | ||
<Button | ||
className={ resetButtonClassName } | ||
variant="tertiary" | ||
onClick={ () => { | ||
onReset(); | ||
onClose(); | ||
} } | ||
disabled={ ! showResetButton } | ||
accessibleWhenDisabled | ||
__next40pxDefaultSize | ||
> | ||
{ __( 'Reset' ) } | ||
{ __( 'Clear' ) } | ||
</Button> | ||
</DropdownContentWrapper> | ||
) } | ||
</div> | ||
</DropdownContentWrapper> |
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.
Are these DOM / layout changes necessary?
- Adding an extra
div
around the reset button - moving the reset button as a child of
DropdownContentWrapper
- renaming and restyling the reset button to the clear button?
In other words, it seems to me that the main issue was the "reset" button being added and removed from the DOM.
If we change the logic from
{ showResetButton && (
<DropdownContentWrapper paddingSize="none">
<Button {...buttonProps} />
</DropdownContentWrapper>
) }
to
<DropdownContentWrapper paddingSize="none">
<Button {...buttonProps} accessibleWhenDisabled disabled={!showResetButton}/>
</DropdownContentWrapper>
wouldn't that be enough?
Is the change from "Reset" to "Clear" necessary, including the UI/layout 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.
Thanks for the review!
Are these DOM / layout changes necessary?
gutenberg/packages/components/src/circular-option-picker/circular-option-picker.tsx
Lines 165 to 169 in 3f0a805
const actions = actionsProp ? ( <div className="components-circular-option-picker__custom-clear-wrapper"> { actionsProp } </div> ) : undefined;
I think this is necessary to align the button to the right.
I used circular-option-picker as a reference.
renaming and restyling the reset button to the clear button?
This was also based on circular-option-picker.
What?
Closes #69065
related
#63310
#68454
Why?
The BorderBoxControl will not display the clear button unless you set the color and style.
Also, when the clear button appears, the position of the popover changes, creating a small amount of stress.
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Before
before.mp4
After
after.mp4