From 5897ab1f853a71da19e7c18fb86c23ccac2f24a5 Mon Sep 17 00:00:00 2001 From: TeodorS Date: Thu, 16 Nov 2023 15:09:42 +0200 Subject: [PATCH 1/2] Sync icon aria-label with coral-card-property title. --- coral-component-card/src/scripts/CardProperty.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coral-component-card/src/scripts/CardProperty.js b/coral-component-card/src/scripts/CardProperty.js index f6d331221a..65b2064cda 100644 --- a/coral-component-card/src/scripts/CardProperty.js +++ b/coral-component-card/src/scripts/CardProperty.js @@ -163,6 +163,10 @@ const CardProperty = Decorator(class extends BaseComponent(HTMLElement) { // Assign the content zones, moving them into place in the process this.content = content; + + // Adjusting icon aria-label attribute as per coral-card-property title attribute + const iconParentTitle = this._elements.icon.parentNode.getAttribute('title'); + this._elements.icon.setAttribute('aria-label', iconParentTitle); } }); From e21e4200743b29d4d4fd79bed1c995ffdbcf3655 Mon Sep 17 00:00:00 2001 From: StoianLucian <101817370+StoianLucian@users.noreply.github.com> Date: Fri, 29 Mar 2024 09:24:59 +0200 Subject: [PATCH 2/2] added null check --- coral-component-card/src/scripts/CardProperty.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coral-component-card/src/scripts/CardProperty.js b/coral-component-card/src/scripts/CardProperty.js index 65b2064cda..8de358d62a 100644 --- a/coral-component-card/src/scripts/CardProperty.js +++ b/coral-component-card/src/scripts/CardProperty.js @@ -165,8 +165,13 @@ const CardProperty = Decorator(class extends BaseComponent(HTMLElement) { this.content = content; // Adjusting icon aria-label attribute as per coral-card-property title attribute - const iconParentTitle = this._elements.icon.parentNode.getAttribute('title'); - this._elements.icon.setAttribute('aria-label', iconParentTitle); + + if(this._elements.icon.parentNode !== null) { + const iconParentTitle = this._elements.icon.parentNode.getAttribute('title'); + this._elements.icon.setAttribute('aria-label', iconParentTitle); + } + + } });