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

Function shouldRestoreFocus

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

Source from the content-addressed store, hash-verified

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

Callers 2

onKeyDownFunction · 0.85
useRestoreFocusFunction · 0.85

Calls 1

getTreeNodeMethod · 0.80

Tested by

no test coverage detected