Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
david-szabo97 committed Dec 10, 2020
1 parent 780edbf commit 90cf052
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/components/src/popover/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ export function computePopoverXAxisPosition(
? leftAlignment.contentWidth
: rightAlignment.contentWidth;

// Limit width of the content to the viewport width
if ( width > window.innerWidth ) {
contentWidth = window.innerWidth;
}

// If we can't find any alignment options that could fit
// our content, then let's fallback to the center of the viewport.
if ( chosenWidth !== width ) {
chosenXAxis = 'center';
centerAlignment.popoverLeft = window.innerWidth / 2;
Expand Down

0 comments on commit 90cf052

Please sign in to comment.