From 5fe3b41ef1652a1c6efd8f40f1214cf58dc4a5c7 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 6 Aug 2024 16:54:23 +0300 Subject: [PATCH] Accessibility text missing for all but last link that opens in new tab (#2832) * Creating separate elements for each link Fixes #2744, SITES-23879 --- .../wcm/components/commons/site/clientlibs/link/js/link.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/commons/site/clientlibs/link/js/link.js b/content/src/content/jcr_root/apps/core/wcm/components/commons/site/clientlibs/link/js/link.js index 184463b2c7..7b1a26c290 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/commons/site/clientlibs/link/js/link.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/commons/site/clientlibs/link/js/link.js @@ -38,11 +38,11 @@ function onDocumentReady() { var linkAccessibilityText = getLinkAccessibilityText(); if (linkAccessibilityText) { - var linkAccessibilityElement = document.createElement("span"); - linkAccessibilityElement.classList.add(linkAccessibilityClass); - linkAccessibilityElement.innerText = linkAccessibilityText; document.querySelectorAll("a[target='_blank']").forEach(function(link) { if (!link.querySelector(selectors.linkAccessibility)) { + var linkAccessibilityElement = document.createElement("span"); + linkAccessibilityElement.classList.add(linkAccessibilityClass); + linkAccessibilityElement.innerText = linkAccessibilityText; link.insertAdjacentElement("beforeend", linkAccessibilityElement); } });