forked from MapComplete/MapComplete
A11y: improve flow with screenreader, some more refactoring to svelte, see #1181
This commit is contained in:
parent
40067e35d4
commit
48ac539272
15 changed files with 188 additions and 226 deletions
|
|
@ -1,20 +1,17 @@
|
|||
import { Translation } from "../UI/i18n/Translation"
|
||||
|
||||
export function ariaLabel(htmlElement: Element, t: Translation) {
|
||||
let onDestroy: () => void = undefined
|
||||
let destroy: () => void = undefined
|
||||
|
||||
t.current.map(
|
||||
(label) => {
|
||||
console.log("Setting arialabel", label, "to", htmlElement)
|
||||
htmlElement.setAttribute("aria-label", label)
|
||||
},
|
||||
[],
|
||||
(f) => {
|
||||
onDestroy = f
|
||||
destroy = f
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
destroy() {},
|
||||
}
|
||||
return { destroy }
|
||||
}
|
||||
|
|
|
|||
17
src/Utils/placeholder.ts
Normal file
17
src/Utils/placeholder.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { Translation } from "../UI/i18n/Translation"
|
||||
|
||||
export function placeholder(htmlElement: HTMLInputElement, t: Translation) {
|
||||
let destroy: () => void = undefined
|
||||
|
||||
t.current.map(
|
||||
(label) => {
|
||||
htmlElement.setAttribute("placeholder", label)
|
||||
},
|
||||
[],
|
||||
(f) => {
|
||||
destroy = f
|
||||
}
|
||||
)
|
||||
|
||||
return { destroy }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue