MCPcopy Create free account
hub / github.com/bvaughn/react-window / getScrollTarget

Function getScrollTarget

lib/utils/scrollElement.ts:18–28  ·  view source on GitHub ↗
(
  containerElement: HTMLElement | null,
  scrollElement: ScrollElement | undefined
)

Source from the content-addressed store, hash-verified

16}
17
18export function getScrollTarget(
19 containerElement: HTMLElement | null,
20 scrollElement: ScrollElement | undefined
21): ScrollTarget | null {
22 if (scrollElement === "window") {
23 // Use the container's own window (e.g. a popup rendered into via a portal)
24 return containerElement ? getOwnerWindow(containerElement) : null;
25 }
26
27 return scrollElement ?? null;
28}
29
30export function getScrollPosition(
31 target: ScrollTarget,

Callers 1

useVirtualizerFunction · 0.90

Calls 1

getOwnerWindowFunction · 0.90

Tested by

no test coverage detected