Skip to content

ColorPicker: Add accessible label for copy button - #67094

Merged
mirka merged 4 commits into
trunkfrom
color-picker-copy-btn-label
Nov 19, 2024
Merged

mirka merged 4 commits into
trunkfrom
color-picker-copy-btn-label

Conversation

@mirka

@mirka mirka commented Nov 18, 2024 •

Copy link
Copy Markdown
Member

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.

@mirka mirka added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components labels Nov 18, 2024
@mirka mirka self-assigned this Nov 18, 2024
@mirka
mirka requested a review from ajitbohra as a code owner November 18, 2024 23:16
@github-actions

github-actions Bot commented Nov 18, 2024 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

>
<CopyButton
size="small"
aria-label={

Copy link
Copy Markdown
Member Author

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.

@tyxla tyxla left a comment

Copy link
Copy Markdown
Member

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 🚢

<CopyButton
size="small"
aria-label={
copiedColor === color.toHex()

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

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
@mirka
mirka enabled auto-merge (squash) November 19, 2024 21:56
@mirka
mirka merged commit dea308b into trunk Nov 19, 2024
@mirka
mirka deleted the color-picker-copy-btn-label branch November 19, 2024 22:28
@github-actions github-actions Bot added this to the Gutenberg 19.8 milestone Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants