From c78bc86e1d828e4bd1572280ec81fa24e2a8f3f4 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Sat, 18 Nov 2023 16:25:02 -0800 Subject: [PATCH] :beetle: Use all available space if offsetParent == body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in the docs’ individual story pages, for example, the body is only the height of the dropdown trigger, so the dropdown winds up being rendered at it’s min-height --- packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts b/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts index 0b86d783..00ffb6eb 100644 --- a/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts +++ b/packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts @@ -82,8 +82,8 @@ const useIsOutOfBounds = (element?: MaybeHTMLElement): OutOfBounds => { const elementRect = useBoundingClientRect(element); const offsetParent = getOverflowHiddenParent(element); const offsetParentRect = useBoundingClientRect(offsetParent); - // If offsetParent is a collapsed element, use viewport height as bottom - if (offsetParent?.tagName === 'BODY' && !offsetParentRect.bottom) { + // If offsetParent is the element, use viewport height as bottom + if (offsetParent?.tagName === 'BODY') { offsetParentRect.bottom = offsetParent.ownerDocument.documentElement.clientHeight; }