Skip to content

Commit

Permalink
Popover: fix __unstableBoundaryParent (#35082)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Oct 8, 2021
1 parent 71ebf54 commit 0fdb83c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions packages/components/src/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,7 @@ const Popover = (

let boundaryElement;
if ( __unstableBoundaryParent ) {
boundaryElement = containerRef.current.closest(
'.popover-slot'
)?.parentNode;
boundaryElement = containerRef.current.parentElement;
}

const usedContentSize = ! contentSize.height
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/popover/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ export function computePopoverXAxisPosition(
}

if ( boundaryElement ) {
const boundaryRect = boundaryElement.getBoundingClientRect();
popoverLeft = Math.min( popoverLeft, boundaryRect.right - width );
popoverLeft = Math.min(
popoverLeft,
boundaryElement.offsetLeft + boundaryElement.offsetWidth - width
);

// Avoid the popover being position beyond the left boundary if the
// direction is left to right.
Expand Down

0 comments on commit 0fdb83c

Please sign in to comment.