forked from MapComplete/MapComplete
Accessibility: add (translatable) aria labels, update to translation system, see #1181
This commit is contained in:
parent
825fd03adb
commit
8a7d8a43ce
12 changed files with 130 additions and 72 deletions
20
src/Utils/ariaLabel.ts
Normal file
20
src/Utils/ariaLabel.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Translation } from "../UI/i18n/Translation"
|
||||
|
||||
export function ariaLabel(htmlElement: Element, t: Translation) {
|
||||
let onDestroy: () => void = undefined
|
||||
|
||||
t.current.map(
|
||||
(label) => {
|
||||
console.log("Setting arialabel", label, "to", htmlElement)
|
||||
htmlElement.setAttribute("aria-label", label)
|
||||
},
|
||||
[],
|
||||
(f) => {
|
||||
onDestroy = f
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
destroy() {},
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue