More work on A11y

This commit is contained in:
Pieter Vander Vennet 2023-12-21 17:36:43 +01:00
parent 87aee9e2b7
commit 6da72b80ef
28 changed files with 398 additions and 209 deletions

View file

@ -1,28 +1,21 @@
import { Translation } from "../UI/i18n/Translation"
import Locale from "../UI/i18n/Locale"
import { Store } from "../Logic/UIEventSource"
export function ariaLabel(htmlElement: Element, t: Translation) {
ariaLabelStore(htmlElement, t?.current)
}
export function ariaLabelStore(htmlElement: Element, t: Store<string>) {
if (!t) {
return
}
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(
t?.mapD(
(label) => {
htmlElement.setAttribute("aria-label", label)
// Set the tooltip, which is the 'title' attribute of an html-element
htmlElement.setAttribute("title", label)
},
[],
(f) => {