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

Function isAncestorScope

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

Source from the content-addressed store, hash-verified

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

Callers 2

FocusScopeFunction · 0.85
onFocusFunction · 0.85

Calls 1

getTreeNodeMethod · 0.80

Tested by

no test coverage detected