diff --git a/libs/blocks/merch/merch.js b/libs/blocks/merch/merch.js index 462cbc54ea..08e3266b1c 100644 --- a/libs/blocks/merch/merch.js +++ b/libs/blocks/merch/merch.js @@ -721,6 +721,19 @@ export async function buildCta(el, params) { reopenModal(cta); }); } + + // Adding aria-label for checkout-link using productFamily and customerSegment as placeholder key. + if (!cta.getAttribute('aria-label')) { + cta.onceSettled().finally(async () => { + const productFamily = cta.value[0]?.productArrangement?.productFamily; + const marketSegment = cta.value[0]?.marketSegments[0]; + const customerSegment = marketSegment === 'EDU' ? marketSegment : cta.value[0]?.customerSegment; + let ariaLabel = cta.textContent; + ariaLabel = productFamily ? `${ariaLabel} - ${await replaceKey(productFamily, getConfig())}` : ariaLabel; + ariaLabel = customerSegment ? `${ariaLabel} - ${await replaceKey(customerSegment, getConfig())}` : ariaLabel; + cta.setAttribute('aria-label', ariaLabel); + }); + } return cta; }