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

Function getScrollParents

packages/react-aria/src/utils/getScrollParents.ts:16–31  ·  view source on GitHub ↗
(node: Element, checkForOverflow?: boolean)

Source from the content-addressed store, hash-verified

14import {isScrollable} from './isScrollable';
15
16export function getScrollParents(node: Element, checkForOverflow?: boolean): Element[] {
17 let parentElements: Element[] = [];
18 let root = document.scrollingElement || document.documentElement;
19
20 while (node) {
21 if (isScrollable(node, checkForOverflow)) {
22 parentElements.push(node);
23 }
24 if (node === root) {
25 break;
26 }
27 node = getParentElement(node) as Element;
28 }
29
30 return parentElements;
31}

Callers 3

scrollIntoViewportFunction · 0.90
scrollCaretIntoViewFunction · 0.90

Calls 3

isScrollableFunction · 0.90
getParentElementFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected