Skip to content

Commit

Permalink
ColorPicker: Add accessible label for copy button (#67094)
Browse files Browse the repository at this point in the history
* ColorPicker: Add accessible label for copy button

* Add changelog

* Use variable

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent d478c08 commit dea308b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- `ToggleGroupControl`: Fix active background for `0` value ([#66855](https://github.com/WordPress/gutenberg/pull/66855)).
- `SlotFill`: Fix a bug where a stale value of `fillProps` could be used ([#67000](https://github.com/WordPress/gutenberg/pull/67000)).
- `ColorPicker`: Add accessible label for copy button ([#67094](https://github.com/WordPress/gutenberg/pull/67094)).

### Enhancements

Expand Down
12 changes: 5 additions & 7 deletions packages/components/src/color-picker/color-copy-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,14 @@ export const ColorCopyButton = ( props: ColorCopyButtonProps ) => {
};
}, [] );

const label =
copiedColor === color.toHex() ? __( 'Copied!' ) : __( 'Copy' );

return (
<Tooltip
delay={ 0 }
hideOnClick={ false }
text={
copiedColor === color.toHex() ? __( 'Copied!' ) : __( 'Copy' )
}
>
<Tooltip delay={ 0 } hideOnClick={ false } text={ label }>
<Button
size="compact"
aria-label={ label }
ref={ copyRef }
icon={ copy }
showTooltip={ false }
Expand Down

0 comments on commit dea308b

Please sign in to comment.