We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents dd679f4 + 733dfb0 commit 1240044Copy full SHA for 1240044
scripts/scripts.js
@@ -65,6 +65,18 @@ function buildAutoBlocks(main) {
65
}
66
67
68
+function a11yLinks(main) {
69
+ const links = main.querySelectorAll('a');
70
+ links.forEach((link) => {
71
+ let label = link.textContent;
72
+ if (!label && link.querySelector('span.icon')) {
73
+ const icon = link.querySelector('span.icon');
74
+ label = icon ? icon.classList[1]?.split('-')[1] : label;
75
+ }
76
+ link.setAttribute('aria-label', label);
77
+ });
78
+}
79
+
80
/**
81
* Decorates the main element.
82
* @param {Element} main The main element
@@ -77,6 +89,8 @@ export function decorateMain(main) {
89
buildAutoBlocks(main);
90
decorateSections(main);
91
decorateBlocks(main);
92
+ // add aria-label to links
93
+ a11yLinks(main);
94
95
96
0 commit comments