From 54eaac2210c4e63c24f2ce5fdb5ab64694ec03e0 Mon Sep 17 00:00:00 2001 From: Ivan Ramljak Date: Fri, 6 Dec 2024 09:41:15 +0100 Subject: [PATCH] Remove labelledby from Icon and set its aria-hidden to be the default --- CHANGELOG.md | 2 +- blocks/init/src/Blocks/components/icon/icon.php | 8 +------- blocks/init/src/Blocks/components/icon/manifest.json | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1982e5..affa553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a - Fix Image component responsive output Co-authored-by: goran.alkovic@infinum.com - Add "Auto" width to wrapperContent and set is as defaults - Add a buttonType attribute to Button component -- Implement a11y for Icon component either by setting aria-hidden to true or using the existing iconName label from manifest option key +- Implement a11y for Icon component either by setting aria-hidden to true (default) or using the existing iconName label from manifest options key - Updated dependencies. ## [1.4.6] diff --git a/blocks/init/src/Blocks/components/icon/icon.php b/blocks/init/src/Blocks/components/icon/icon.php index 95fe27d..8bf3dec 100644 --- a/blocks/init/src/Blocks/components/icon/icon.php +++ b/blocks/init/src/Blocks/components/icon/icon.php @@ -44,13 +44,7 @@ } if (!empty($iconTitle)) { - $uniqueId = Helpers::getUnique(); - $titleId = esc_attr("{$iconName}_title_{$uniqueId}"); - - $ariaLabelledby = 'aria-labelledby="' . $titleId . '"'; - $titleTag = '' . esc_html($iconTitle) . ''; - - $icon = str_replace(''; $icon = str_replace('', $titleTag . '', $icon); } } diff --git a/blocks/init/src/Blocks/components/icon/manifest.json b/blocks/init/src/Blocks/components/icon/manifest.json index 51a298f..5d258a6 100644 --- a/blocks/init/src/Blocks/components/icon/manifest.json +++ b/blocks/init/src/Blocks/components/icon/manifest.json @@ -24,7 +24,7 @@ }, "iconAriaHidden": { "type": "boolean", - "default": false + "default": true } }, "options": {