2023-12-12 19:18:50 +01:00
|
|
|
import { Translation } from "../UI/i18n/Translation"
|
|
|
|
|
|
|
|
|
|
export function ariaLabel(htmlElement: Element, t: Translation) {
|
2023-12-14 18:25:35 +01:00
|
|
|
if (!t) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2023-12-13 02:16:53 +01:00
|
|
|
let destroy: () => void = undefined
|
2023-12-12 19:18:50 +01:00
|
|
|
|
|
|
|
|
t.current.map(
|
|
|
|
|
(label) => {
|
|
|
|
|
htmlElement.setAttribute("aria-label", label)
|
|
|
|
|
},
|
|
|
|
|
[],
|
|
|
|
|
(f) => {
|
2023-12-13 02:16:53 +01:00
|
|
|
destroy = f
|
2023-12-12 19:18:50 +01:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-13 02:16:53 +01:00
|
|
|
return { destroy }
|
2023-12-12 19:18:50 +01:00
|
|
|
}
|