Skip to content

Commit

Permalink
Initialize the content size used in Popover computation
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jun 18, 2020
1 parent 881b7f2 commit 01e8664
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/components/src/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ const Popover = ( {
const slot = useSlot( __unstableSlotName );
const isExpanded = expandOnMobile && isMobileViewport;
const [ containerResizeListener, contentSize ] = useResizeObserver();

noArrow = isExpanded || noArrow;

useEffect( () => {
Expand Down Expand Up @@ -330,6 +329,10 @@ const Popover = ( {
)?.parentNode;
}

const usedContentSize = ! contentSize.height
? contentRef.current.getBoundingClientRect()
: contentSize;

const {
popoverTop,
popoverLeft,
Expand All @@ -339,7 +342,7 @@ const Popover = ( {
contentWidth,
} = computePopoverPosition(
anchor,
contentSize,
usedContentSize,
position,
__unstableSticky,
containerRef.current,
Expand Down

0 comments on commit 01e8664

Please sign in to comment.