Skip to content

Commit 1e7b572

Browse files
committed
feat(popover): adjust popover to position in the center with no event
references #5420
1 parent ec540c4 commit 1e7b572

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/popover/popover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const POPOVER_BODY_PADDING = 2;
3232
* The first argument passed to the `present` should be the popover. In order
3333
* to position the popover relative to the element clicked, the event needs to be
3434
* passed as the second argument. If the event is not passed, the popover will be
35-
* positioned at the top of the current view. See the [usage](#usage) section for
35+
* positioned in the center of the current view. See the [usage](#usage) section for
3636
* an example of passing this event.
3737
*
3838
* ### Dismissing
@@ -250,7 +250,7 @@ class PopoverTransition extends Transition {
250250
let bodyWidth = window.innerWidth;
251251
let bodyHeight = window.innerHeight;
252252

253-
let targetTop = POPOVER_BODY_PADDING;
253+
let targetTop = (bodyHeight / 2) - (popoverHeight / 2);
254254
let targetLeft = bodyWidth / 2;
255255
let targetWidth = 0;
256256
let targetHeight = 0;

0 commit comments

Comments
 (0)