Skip to content

Commit bd46d7b

Browse files
authored
fix(ui5-popover): close popup when no opener (#1630)
1 parent 0c32950 commit bd46d7b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/main/src/Popover.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ class Popover extends Popup {
379379
return (limits[placement] < 0 || (limits[placement] + threshold > closedPopupParent.innerHeight)) || overflowsBottom || overflowsTop;
380380
}
381381

382+
shouldCloseDueToNoOpener(openerRect) {
383+
return openerRect.top === 0
384+
&& openerRect.bottom === 0
385+
&& openerRect.left === 0
386+
&& openerRect.right === 0;
387+
}
388+
382389
reposition() {
383390
const popoverSize = this.popoverSize;
384391
const openerRect = this._opener.getBoundingClientRect();
@@ -459,7 +466,7 @@ class Popover extends Popup {
459466

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

462-
this._preventRepositionAndClose = this.shouldCloseDueToOverflow(placementType, targetRect);
469+
this._preventRepositionAndClose = this.shouldCloseDueToNoOpener(targetRect) || this.shouldCloseDueToOverflow(placementType, targetRect);
463470

464471
const isVertical = placementType === PopoverPlacementType.Top
465472
|| placementType === PopoverPlacementType.Bottom;

0 commit comments

Comments
 (0)