(element: Element, scope: ScopeRef = null)
| 489 | } |
| 490 | |
| 491 | function isElementInChildScope(element: Element, scope: ScopeRef = null) { |
| 492 | // If the element is within a top layer element (e.g. toasts), always allow moving focus there. |
| 493 | if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) { |
| 494 | return true; |
| 495 | } |
| 496 | |
| 497 | // node.contains in isElementInScope covers child scopes that are also DOM children, |
| 498 | // but does not cover child scopes in portals. |
| 499 | for (let {scopeRef: s} of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))) { |
| 500 | if (s && isElementInScope(element, s.current)) { |
| 501 | return true; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | return false; |
| 506 | } |
| 507 | |
| 508 | /** @private */ |
| 509 | export function isElementInChildOfActiveScope(element: Element): boolean { |
no test coverage detected