Skip to content

Commit

Permalink
improve a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuntze committed Dec 18, 2024
1 parent fa514a3 commit fc8cd5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions blocks/cards/cards.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
function makeAccessible(block) {
const links = block.querySelectorAll('a');
links.forEach((link) => {
link.setAttribute('tabindex', '0');
link.setAttribute('role', 'link');
link.setAttribute('aria-label', link.textContent);
});
}

export default function decorate(block) {
/* change to ul, li */
const ul = document.createElement('ul');
Expand All @@ -17,4 +26,5 @@ export default function decorate(block) {
});
block.textContent = '';
block.append(ul);
makeAccessible(block);
}

0 comments on commit fc8cd5e

Please sign in to comment.