forked from MapComplete/MapComplete
A11y: move buttons into fields
This commit is contained in:
parent
30c9034e7b
commit
1b10f1f64d
23 changed files with 529 additions and 414 deletions
11
src/Utils.ts
11
src/Utils.ts
|
@ -1638,13 +1638,22 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
return newObj
|
||||
}
|
||||
|
||||
public static focusOn(el: HTMLElement): void {
|
||||
if (!el) {
|
||||
return
|
||||
}
|
||||
requestAnimationFrame(() => {
|
||||
el.focus()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches a child that can be focused on, by first selecting a 'focusable', then a button, then a link
|
||||
*
|
||||
* Returns the focussed element
|
||||
* @param el
|
||||
*/
|
||||
public static focusOnFocusableChild(el: HTMLElement): undefined {
|
||||
public static focusOnFocusableChild(el: HTMLElement): void {
|
||||
if (!el) {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue