Skip to content

Commit

Permalink
adding card-heading
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchoi-dev committed Jan 22, 2025
1 parent 886bec8 commit 2cf9f9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/blocks/merch-card/merch-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,14 +707,14 @@ export default async function init(el) {
el.replaceWith(merchCard);
decorateMerchCardLinkAnalytics(merchCard);

// Adding aria-label for checkout-link using productFamily as placeholder key
// Adding aria-label for checkout-link using productFamily as placeholder key and card-heading
const ctaLink = ctas?.querySelector('a');
if (ctaLink && !ctaLink.getAttribute('aria-label')) {
const { replaceKey } = await import('../../features/placeholders.js');
ctaLink.addEventListener('mas:resolved', async () => {
const productName = ctaLink.value[0]?.productArrangement?.productFamily;
if (productName) {
await replaceKey(productName, getConfig()).then((label) => ctaLink.setAttribute('aria-label', `${ctaLink.textContent} - ${label}`));
await replaceKey(productName, getConfig()).then((label) => ctaLink.setAttribute('aria-label', `${ctaLink.textContent} ${label} ${merchCard.querySelector('.card-heading')?.textContent}`));
}

Check warning on line 718 in libs/blocks/merch-card/merch-card.js

View check run for this annotation

Codecov / codecov/patch

libs/blocks/merch-card/merch-card.js#L715-L718

Added lines #L715 - L718 were not covered by tests
});
}
Expand Down

0 comments on commit 2cf9f9a

Please sign in to comment.