(scopeRef: RefObject<Element[] | null>, autoFocus?: boolean)
| 560 | } |
| 561 | |
| 562 | function useAutoFocus(scopeRef: RefObject<Element[] | null>, autoFocus?: boolean) { |
| 563 | const autoFocusRef = React.useRef(autoFocus); |
| 564 | useEffect(() => { |
| 565 | if (autoFocusRef.current) { |
| 566 | activeScope = scopeRef; |
| 567 | const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined); |
| 568 | if ( |
| 569 | !isElementInScope(getActiveElement(ownerDocument), activeScope.current) && |
| 570 | scopeRef.current |
| 571 | ) { |
| 572 | focusFirstInScope(scopeRef.current); |
| 573 | } |
| 574 | } |
| 575 | autoFocusRef.current = false; |
| 576 | }, [scopeRef]); |
| 577 | } |
| 578 | |
| 579 | function useActiveScopeTracker( |
| 580 | scopeRef: RefObject<Element[] | null>, |
no test coverage detected