From 17d1b31c6c2ce61ade7b4c6b3845b1ed5910999c Mon Sep 17 00:00:00 2001 From: ens13533 Date: Mon, 1 Jul 2024 13:46:19 +0300 Subject: [PATCH 1/5] fixed axeDevtools error by adding title attribute --- coral-component-dialog/src/scripts/Dialog.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/coral-component-dialog/src/scripts/Dialog.js b/coral-component-dialog/src/scripts/Dialog.js index 33c5181df6..14e48f521a 100644 --- a/coral-component-dialog/src/scripts/Dialog.js +++ b/coral-component-dialog/src/scripts/Dialog.js @@ -221,6 +221,8 @@ const Dialog = Decorator(class extends BaseOverlay(BaseComponent(HTMLElement)) { tagName: 'coral-dialog-content', insert: function (content) { content.classList.add(`${CLASSNAME}-content`); + const coralIcon = content.querySelector('coral-icon'); + coralIcon.setAttribute('title', 'infoCircle'); const footer = this.footer; // The content should always be before footer this._elements.wrapper.insertBefore(content, this.contains(footer) && footer || null); @@ -297,6 +299,15 @@ const Dialog = Decorator(class extends BaseOverlay(BaseComponent(HTMLElement)) { // Remove all variant classes this._elements.wrapper.classList.remove(...ALL_VARIANT_CLASSES); + const deleteButton = document.getElementsByClassName('cq-siteadmin-admin-actions-delete-activator'); + deleteButton[0].addEventListener('click', () => { + setTimeout(() => { + const coralDialog = this._elements.wrapper.querySelector('coral-dialog-content'); + const coralIcon = coralDialog.getElementsByTagName('coral-icon'); + coralIcon[0].setAttribute('title', 'infoCircle'); + }, 1000); + }); + if (this._variant === variant.DEFAULT) { // ARIA this.setAttribute('role', 'dialog'); From c085b4af62ceaeb0700045f606967d9c24476a81 Mon Sep 17 00:00:00 2001 From: ens13533 Date: Mon, 1 Jul 2024 14:17:53 +0300 Subject: [PATCH 2/5] fixed axeDevtools error by adding title attribute --- coral-component-dialog/src/scripts/Dialog.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/coral-component-dialog/src/scripts/Dialog.js b/coral-component-dialog/src/scripts/Dialog.js index 14e48f521a..b4f9d89700 100644 --- a/coral-component-dialog/src/scripts/Dialog.js +++ b/coral-component-dialog/src/scripts/Dialog.js @@ -300,13 +300,15 @@ const Dialog = Decorator(class extends BaseOverlay(BaseComponent(HTMLElement)) { this._elements.wrapper.classList.remove(...ALL_VARIANT_CLASSES); const deleteButton = document.getElementsByClassName('cq-siteadmin-admin-actions-delete-activator'); - deleteButton[0].addEventListener('click', () => { - setTimeout(() => { - const coralDialog = this._elements.wrapper.querySelector('coral-dialog-content'); - const coralIcon = coralDialog.getElementsByTagName('coral-icon'); - coralIcon[0].setAttribute('title', 'infoCircle'); - }, 1000); - }); + if (deleteButton[0]) { + deleteButton[0].addEventListener('click', () => { + setTimeout(() => { + const coralDialog = this._elements.wrapper.querySelector('coral-dialog-content'); + const coralIcon = coralDialog.getElementsByTagName('coral-icon'); + coralIcon[0].setAttribute('title', 'infoCircle'); + }, 1000); + }); + } if (this._variant === variant.DEFAULT) { // ARIA From 58ebe60ad1a7e5f3d6e8cf8a9fdd46682d2da73b Mon Sep 17 00:00:00 2001 From: ens13533 Date: Mon, 1 Jul 2024 14:26:08 +0300 Subject: [PATCH 3/5] fixed axeDevtools error by adding title attribute --- coral-component-dialog/src/scripts/Dialog.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coral-component-dialog/src/scripts/Dialog.js b/coral-component-dialog/src/scripts/Dialog.js index b4f9d89700..81cc57ac3b 100644 --- a/coral-component-dialog/src/scripts/Dialog.js +++ b/coral-component-dialog/src/scripts/Dialog.js @@ -305,7 +305,9 @@ const Dialog = Decorator(class extends BaseOverlay(BaseComponent(HTMLElement)) { setTimeout(() => { const coralDialog = this._elements.wrapper.querySelector('coral-dialog-content'); const coralIcon = coralDialog.getElementsByTagName('coral-icon'); - coralIcon[0].setAttribute('title', 'infoCircle'); + if (coralIcon[0]) { + coralIcon[0].setAttribute('title', 'infoCircle'); + } }, 1000); }); } From 4cc28c14089156d79c954d8643b0a5230001939a Mon Sep 17 00:00:00 2001 From: ens13533 Date: Mon, 1 Jul 2024 14:32:33 +0300 Subject: [PATCH 4/5] fixed axeDevtools error by adding title attribute --- coral-component-dialog/src/scripts/Dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coral-component-dialog/src/scripts/Dialog.js b/coral-component-dialog/src/scripts/Dialog.js index 81cc57ac3b..c7ea573537 100644 --- a/coral-component-dialog/src/scripts/Dialog.js +++ b/coral-component-dialog/src/scripts/Dialog.js @@ -305,7 +305,7 @@ const Dialog = Decorator(class extends BaseOverlay(BaseComponent(HTMLElement)) { setTimeout(() => { const coralDialog = this._elements.wrapper.querySelector('coral-dialog-content'); const coralIcon = coralDialog.getElementsByTagName('coral-icon'); - if (coralIcon[0]) { + if (coralIcon !== null) { coralIcon[0].setAttribute('title', 'infoCircle'); } }, 1000); From 7d239daeeaaff14641434b4c475093873ba7c9aa Mon Sep 17 00:00:00 2001 From: ens13533 Date: Mon, 1 Jul 2024 14:36:47 +0300 Subject: [PATCH 5/5] fixed axeDevtools error by adding title attribute --- coral-component-dialog/src/scripts/Dialog.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coral-component-dialog/src/scripts/Dialog.js b/coral-component-dialog/src/scripts/Dialog.js index c7ea573537..d06b2da4c2 100644 --- a/coral-component-dialog/src/scripts/Dialog.js +++ b/coral-component-dialog/src/scripts/Dialog.js @@ -222,7 +222,9 @@ const Dialog = Decorator(class extends BaseOverlay(BaseComponent(HTMLElement)) { insert: function (content) { content.classList.add(`${CLASSNAME}-content`); const coralIcon = content.querySelector('coral-icon'); - coralIcon.setAttribute('title', 'infoCircle'); + if (coralIcon !== null) { + coralIcon.setAttribute('title', 'infoCircle'); + } const footer = this.footer; // The content should always be before footer this._elements.wrapper.insertBefore(content, this.contains(footer) && footer || null);