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

Function getScrollParent

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

Source from the content-addressed store, hash-verified

13import {isScrollable} from './isScrollable';
14
15export function getScrollParent(node: Element, checkForOverflow?: boolean): Element {
16 let scrollableNode: Element | null = node;
17 if (isScrollable(scrollableNode, checkForOverflow)) {
18 scrollableNode = scrollableNode.parentElement;
19 }
20
21 while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {
22 scrollableNode = scrollableNode.parentElement;
23 }
24
25 return scrollableNode || document.scrollingElement || document.documentElement;
26}

Callers 9

useLoadMoreSentinelFunction · 0.90
useCalendarCellFunction · 0.90
focusFunction · 0.90
onKeyDownCaptureFunction · 0.90
onKeyDownCaptureFunction · 0.90
onTouchStartFunction · 0.90
scrollIntoViewFunction · 0.90
useAutoScrollFunction · 0.90
onFocusFunction · 0.90

Calls 1

isScrollableFunction · 0.90

Tested by

no test coverage detected