MapComplete/src/Utils/ariaLabel.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
400 B
TypeScript
Raw Normal View History

import { Translation } from "../UI/i18n/Translation"
export function ariaLabel(htmlElement: Element, t: Translation) {
if (!t) {
return
}
let destroy: () => void = undefined
t.current.map(
(label) => {
htmlElement.setAttribute("aria-label", label)
},
[],
(f) => {
destroy = f
}
)
return { destroy }
}