Skip to content

Commit

Permalink
🪲 Use all available space if offsetParent == body
Browse files Browse the repository at this point in the history
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
  • Loading branch information
acusti committed Nov 19, 2023
1 parent 489a1c0 commit c78bc86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/use-is-out-of-bounds/src/useIsOutOfBounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <body> element, use viewport height as bottom
if (offsetParent?.tagName === 'BODY' && !offsetParentRect.bottom) {
// If offsetParent is the <body> element, use viewport height as bottom
if (offsetParent?.tagName === 'BODY') {
offsetParentRect.bottom = offsetParent.ownerDocument.documentElement.clientHeight;
}

Expand Down

0 comments on commit c78bc86

Please sign in to comment.