MCPcopy Index your code
hub / github.com/primer/react / getScrollContainer

Function getScrollContainer

packages/react/src/utils/scroll.ts:5–11  ·  view source on GitHub ↗
(element: Element | null)

Source from the content-addressed store, hash-verified

3 * is not contained in a scrollable element.
4 */
5export function getScrollContainer(element: Element | null): Element | null {
6 if (!element || element === document.body) {
7 return null
8 }
9
10 return isScrollable(element) ? element : getScrollContainer(element.parentElement)
11}
12
13/** Returns `true` if the element is scrollable */
14function isScrollable(element: Element) {

Callers 2

getPageSizeFunction · 0.90
useStickyPaneHeightFunction · 0.90

Calls 1

isScrollableFunction · 0.85

Tested by

no test coverage detected