From 1e225f701f2d21380b6e1a28b6a7cf88ad10b230 Mon Sep 17 00:00:00 2001 From: Sam Seay Date: Mon, 29 Apr 2024 09:35:47 +0800 Subject: [PATCH] Add aria label to the customer account block link (#46899) --- .../assets/js/blocks/customer-account/block.tsx | 8 ++++++++ .../46899-dev-fix-a11y-icon-only-customer-account-block | 4 ++++ .../woocommerce/src/Blocks/BlockTypes/CustomerAccount.php | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/46899-dev-fix-a11y-icon-only-customer-account-block diff --git a/plugins/woocommerce-blocks/assets/js/blocks/customer-account/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/customer-account/block.tsx index e3c348e6c62..c0a2c9e437b 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/customer-account/block.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/customer-account/block.tsx @@ -56,12 +56,20 @@ export const CustomerAccountBlock = ( { } ): JSX.Element => { const { displayStyle, iconStyle, iconClass } = attributes; + const ariaAttributes = + displayStyle === DisplayStyle.ICON_ONLY + ? { + 'aria-label': __( 'My Account', 'woocommerce' ), + } + : {}; + return ( ' . wp_kses( $this->render_label(), array() ) . ''; return "
- + " . wp_kses( $this->render_icon( $attributes ), $allowed_svg ) . $label_markup . '
';