-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ColorPicker: Add accessible label for copy button #67094
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. |
@@ -65,6 +65,11 @@ export const ColorCopyButton = ( props: ColorCopyButtonProps ) => { | |||
> | |||
<CopyButton | |||
size="small" | |||
aria-label={ |
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 shouldn't result in a redundant ARIA description, thanks to #65989.
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 👍
Just one tiny deduplication suggestion before 🚢
@@ -65,6 +65,11 @@ export const ColorCopyButton = ( props: ColorCopyButtonProps ) => { | |||
> | |||
<CopyButton | |||
size="small" | |||
aria-label={ | |||
copiedColor === color.toHex() |
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.
Could we put this in a variable? This is literally the same we're passing over to the text
prop, so we could avoid the duplication.
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.
Good point!
# Conflicts: # packages/components/src/color-picker/color-copy-button.tsx
Alternative to #57168
Addresses ##57157 (maybe not a full fix)
What?
Adds an accessible label for the copy button in ColorPicker.
Why?
The icon button was only associated with an ARIA description via the Tooltip, and didn't have an ARIA label. This is a pretty big bug for which the fix was stalled in #57168, so I'm proposing we address this now in a less controversial way.
Testing Instructions for Keyboard
See the Storybook story for ColorPicker and check that the copy button is accessibly labeled.