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

Function isElementInScope

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

Source from the content-addressed store, hash-verified

480}
481
482function isElementInScope(element?: Element | null, scope?: Element[] | null) {
483 if (!element) {
484 return false;
485 }
486 if (!scope) {
487 return false;
488 }
489 return scope.some(node => nodeContains(node, element));
490}
491
492function isElementInChildScope(element: Element, scope: ScopeRef = null) {
493 // 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