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

Function isElementInScope

packages/react-aria/src/focus/FocusScope.tsx:498–506  ·  view source on GitHub ↗
(element?: Element | null, scope?: Element[] | null)

Source from the content-addressed store, hash-verified

496}
497
498function isElementInScope(element?: Element | null, scope?: Element[] | null) {
499 if (!element) {
500 return false;
501 }
502 if (!scope) {
503 return false;
504 }
505 return scope.some(node => nodeContains(node, element));
506}
507
508function isElementInChildScope(element: Element, scope: ScopeRef = null) {
509 // If the element is within a top layer element (e.g. toasts), always allow moving focus there.

Callers 9

FocusScopeFunction · 0.85
focusNextFunction · 0.85
focusPreviousFunction · 0.85
onKeyDownFunction · 0.85
onFocusFunction · 0.85
isElementInChildScopeFunction · 0.85
useAutoFocusFunction · 0.85
acceptNodeFunction · 0.85
removeTreeNodeMethod · 0.85

Calls 1

nodeContainsFunction · 0.90

Tested by

no test coverage detected