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

Function getOwnerWindow

packages/react-aria/src/utils/domHelpers.ts:25–30  ·  view source on GitHub ↗
(target?: EventTarget | null)

Source from the content-addressed store, hash-verified

23};
24
25export const getOwnerWindow = (target?: EventTarget | null): Window & typeof globalThis => {
26 let ownerDocument = getOwnerDocument(target);
27
28 // @ts-expect-error Ensure safe access in SSR environments.
29 return ownerDocument?.defaultView ?? (typeof window !== 'undefined' ? window : undefined);
30};
31
32/**
33 * Attaches an event listener on target(s) and returns a cleanup function.

Callers 15

domHelpers.test.jsFile · 0.90
Pressable.tsxFile · 0.90
usePressFunction · 0.90
isValidKeyboardEventFunction · 0.90
onMouseUpFunction · 0.90
useMoveFunction · 0.90
onTouchEndFunction · 0.90
onPointerUpFunction · 0.90
handleFocusEventFunction · 0.90
setupGlobalFocusEventsFunction · 0.90
isKeyboardFocusEventFunction · 0.90

Calls 1

getOwnerDocumentFunction · 0.85

Tested by

no test coverage detected