(ref: R, fallbackElement?: T)
| 42 | * If no fallback is specified then we focus the container itself. |
| 43 | */ |
| 44 | export const focusLastDescendant = <R extends HTMLElement, T extends HTMLElement>(ref: R, fallbackElement?: T) => { |
| 45 | const inputs = Array.from(ref.querySelectorAll<HTMLElement>(focusableQueryString)); |
| 46 | const lastInput = inputs.length > 0 ? inputs[inputs.length - 1] : null; |
| 47 | |
| 48 | focusElementInContext(lastInput, fallbackElement ?? ref); |
| 49 | }; |
| 50 | |
| 51 | /** |
| 52 | * Focuses a particular element in a context. If the element |
no test coverage detected