(scopeRef: RefObject<Element[] | null>, autoFocus?: boolean)
| 578 | } |
| 579 | |
| 580 | function useAutoFocus(scopeRef: RefObject<Element[] | null>, autoFocus?: boolean) { |
| 581 | const autoFocusRef = React.useRef(autoFocus); |
| 582 | useEffect(() => { |
| 583 | if (autoFocusRef.current) { |
| 584 | activeScope = scopeRef; |
| 585 | const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined); |
| 586 | if ( |
| 587 | !isElementInScope(getActiveElement(ownerDocument), activeScope.current) && |
| 588 | scopeRef.current |
| 589 | ) { |
| 590 | focusFirstInScope(scopeRef.current); |
| 591 | } |
| 592 | } |
| 593 | autoFocusRef.current = false; |
| 594 | }, [scopeRef]); |
| 595 | } |
| 596 | |
| 597 | function useActiveScopeTracker( |
| 598 | scopeRef: RefObject<Element[] | null>, |
no test coverage detected