diff --git a/packages/use-bounding-client-rect/src/useBoundingClientRect.ts b/packages/use-bounding-client-rect/src/useBoundingClientRect.ts index 14055355..f3b560d7 100644 --- a/packages/use-bounding-client-rect/src/useBoundingClientRect.ts +++ b/packages/use-bounding-client-rect/src/useBoundingClientRect.ts @@ -143,7 +143,7 @@ const cleanupHookInstance = (element: HTMLElement, setRenderTime: SetRenderTime) refs.maybeCleanupElement(); }; -const useBoundingClientRect = (element: HTMLElement | null): Rect | EmptyRect => { +const useBoundingClientRect = (element?: HTMLElement | null): Rect | EmptyRect => { // Flip the bit to trigger a new return value from this hook const [, setRenderTime] = useState(0); diff --git a/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts b/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts index 947c4d74..0b86d783 100644 --- a/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts +++ b/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts @@ -29,7 +29,7 @@ const INITIAL_OUT_OF_BOUNDS_HAS_LAYOUT: OutOfBounds = Object.freeze({ hasLayout: true, }); -const getOverflowHiddenParent = (element: MaybeHTMLElement): MaybeHTMLElement => { +const getOverflowHiddenParent = (element?: MaybeHTMLElement): MaybeHTMLElement => { while (element?.parentElement) { // If we’ve reached the body, use that as offsetParent if (element.parentElement.tagName === 'BODY') return element.parentElement; @@ -76,7 +76,7 @@ const getIsCurrentDirectionBefore = ({ return positionAfter < length / 2; }; -const useIsOutOfBounds = (element: MaybeHTMLElement): OutOfBounds => { +const useIsOutOfBounds = (element?: MaybeHTMLElement): OutOfBounds => { const outOfBoundsRef = useRef(INITIAL_OUT_OF_BOUNDS); const computedStyleRef = useRef(null); const elementRect = useBoundingClientRect(element);