MCPcopy Create free account
hub / github.com/adobe/react-spectrum / shouldRestoreFocus

Function shouldRestoreFocus

packages/react-aria/src/focus/FocusScope.tsx:614–625  ·  view source on GitHub ↗
(scopeRef: ScopeRef)

Source from the content-addressed store, hash-verified

612}
613
614function shouldRestoreFocus(scopeRef: ScopeRef) {
615 let scope = focusScopeTree.getTreeNode(activeScope);
616 while (scope && scope.scopeRef !== scopeRef) {
617 if (scope.nodeToRestore) {
618 return false;
619 }
620
621 scope = scope.parent;
622 }
623
624 return scope?.scopeRef === scopeRef;
625}
626
627function useRestoreFocus(
628 scopeRef: RefObject<Element[] | null>,

Callers 2

onKeyDownFunction · 0.85
useRestoreFocusFunction · 0.85

Calls 1

getTreeNodeMethod · 0.80

Tested by

no test coverage detected