Skip to content

Commit

Permalink
fix(ui5-popover): close popup when no opener (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhan007 committed May 15, 2020
1 parent 0c32950 commit bd46d7b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/main/src/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ class Popover extends Popup {
return (limits[placement] < 0 || (limits[placement] + threshold > closedPopupParent.innerHeight)) || overflowsBottom || overflowsTop;
}

shouldCloseDueToNoOpener(openerRect) {
return openerRect.top === 0
&& openerRect.bottom === 0
&& openerRect.left === 0
&& openerRect.right === 0;
}

reposition() {
const popoverSize = this.popoverSize;
const openerRect = this._opener.getBoundingClientRect();
Expand Down Expand Up @@ -459,7 +466,7 @@ class Popover extends Popup {

const placementType = this.getActualPlacementType(targetRect, popoverSize);

this._preventRepositionAndClose = this.shouldCloseDueToOverflow(placementType, targetRect);
this._preventRepositionAndClose = this.shouldCloseDueToNoOpener(targetRect) || this.shouldCloseDueToOverflow(placementType, targetRect);

const isVertical = placementType === PopoverPlacementType.Top
|| placementType === PopoverPlacementType.Bottom;
Expand Down

0 comments on commit bd46d7b

Please sign in to comment.