1 | /* @flow */
|
2 | const selector = 'input, a, textarea, select, button, [tabIndex]:not([tabIndex="-1"])';
|
3 |
|
4 | export function getFocusBounds(element: HTMLElement): Array<?HTMLElement> {
|
5 | const focusableChildren = element.querySelectorAll(selector);
|
6 | return [focusableChildren[0] || null, focusableChildren[focusableChildren.length - 1] || null];
|
7 | }
|
8 |
|
9 | export function getFirstFocusableChild(element: HTMLElement): ?HTMLElement {
|
10 | return element.querySelector(selector);
|
11 | }
|