-
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
Shadow Panel: Add reset button #68981
Shadow Panel: Add reset button #68981
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. |
packages/block-editor/src/components/global-styles/shadow-panel-components.js
Outdated
Show resolved
Hide resolved
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.
This PR works well, but from an accessibility perspective, we need to check the following points in particular:
- It must be operable only via keyboard.
- The focus must never be lost.
That is, the focus must not be lost when the reset button is pressed. See this implementation for reference:
gutenberg/packages/block-editor/src/components/colors-gradients/dropdown.js
Lines 136 to 137 in 0feca71
// Return focus to parent button | |
colorButtonRef.current?.focus(); |
Do I also extract the renderToggle logic into a generalized reusable component within this PR and use it within shadow-panel component? Ref: #68973 (comment) |
Personally, I find it easier to implement reset buttons in all the places and then extract them into reusable components. |
0456fd8
to
a397d3b
Compare
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.
LGTM! I think everything is working as expected.
What, Why and How?
Closes #68973
This PR adds a reset button to the
Shadow Panel
, which becomes visible on hover or focus.Testing Instructions
post edit
page.Group block
and try changing the defaultshadow
.reset
button, which appears on hover.reset
button and confirm the shadow gets reset.Screencast
shadow-demo.mov