A11y: various improvements

This commit is contained in:
Pieter Vander Vennet 2023-12-19 22:21:34 +01:00
parent 0d4f2c9c36
commit 5fa2ddd9c1
23 changed files with 327 additions and 98 deletions

View file

@ -1,4 +1,5 @@
import { Translation } from "../UI/i18n/Translation"
import Locale from "../UI/i18n/Locale"
export function ariaLabel(htmlElement: Element, t: Translation) {
if (!t) {
@ -6,6 +7,19 @@ export function ariaLabel(htmlElement: Element, t: Translation) {
}
let destroy: () => void = undefined
Locale.language.map((language) => {
if (!t.translations[language]) {
console.log(
"No aria label in",
language,
"for",
t.context,
"; en is",
t.translations["en"]
)
}
})
t.current.map(
(label) => {
htmlElement.setAttribute("aria-label", label)