From 97a20db9122d0218de82ddf9b40170561ad21500 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Tue, 19 Nov 2024 08:12:00 +0900 Subject: [PATCH 1/3] ColorPicker: Add accessible label for copy button --- packages/components/src/color-picker/color-copy-button.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/components/src/color-picker/color-copy-button.tsx b/packages/components/src/color-picker/color-copy-button.tsx index b8a4822544322c..ffc60eebb685dd 100644 --- a/packages/components/src/color-picker/color-copy-button.tsx +++ b/packages/components/src/color-picker/color-copy-button.tsx @@ -65,6 +65,11 @@ export const ColorCopyButton = ( props: ColorCopyButtonProps ) => { > Date: Tue, 19 Nov 2024 08:16:32 +0900 Subject: [PATCH 2/3] Add changelog --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index d93eb30ac0ec50..2db27b47d847d9 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -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)). ### Experimental From 4d043a2ea674b3e56e0968c44690f83c1925a49f Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 20 Nov 2024 06:49:16 +0900 Subject: [PATCH 3/3] Use variable --- .../src/color-picker/color-copy-button.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/components/src/color-picker/color-copy-button.tsx b/packages/components/src/color-picker/color-copy-button.tsx index ffc60eebb685dd..c301add5212f9a 100644 --- a/packages/components/src/color-picker/color-copy-button.tsx +++ b/packages/components/src/color-picker/color-copy-button.tsx @@ -55,21 +55,14 @@ export const ColorCopyButton = ( props: ColorCopyButtonProps ) => { }; }, [] ); + const label = + copiedColor === color.toHex() ? __( 'Copied!' ) : __( 'Copy' ); + return ( - +