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

Function isAncestorScope

packages/react-aria/src/focus/FocusScope.tsx:514–523  ·  view source on GitHub ↗
(ancestor: ScopeRef, scope: ScopeRef)

Source from the content-addressed store, hash-verified

512}
513
514function isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {
515 let parent = focusScopeTree.getTreeNode(scope)?.parent;
516 while (parent) {
517 if (parent.scopeRef === ancestor) {
518 return true;
519 }
520 parent = parent.parent;
521 }
522 return false;
523}
524
525function focusElement(element: FocusableElement | null, scroll = false) {
526 if (element != null && !scroll) {

Callers 2

FocusScopeFunction · 0.85
onFocusFunction · 0.85

Calls 1

getTreeNodeMethod · 0.80

Tested by

no test coverage detected