This commit is contained in:
amandaesmith3
2024-02-16 12:55:05 -06:00
parent 0d7497abe0
commit c4918b93a3
2 changed files with 6 additions and 12 deletions

View File

@@ -54,16 +54,7 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
const padding = size === 'cover' ? 0 : POPOVER_IOS_BODY_PADDING;
const {
originX,
originY,
top,
left,
bottom,
arrowTop,
arrowLeft,
addPopoverBottomClass,
} = calculateWindowAdjustment(
const { originX, originY, top, left, bottom, arrowTop, arrowLeft, addPopoverBottomClass } = calculateWindowAdjustment(
side,
results.top,
results.left,

View File

@@ -850,7 +850,7 @@ export const calculateWindowAdjustment = (
*/
let horizontalSafeAreaApprox = 0;
let verticalSafeAreaApprox = 0;
if (win !== undefined && win.matchMedia !== undefined) {
if (win?.matchMedia !== undefined) {
verticalSafeAreaApprox = win.innerHeight * 0.05;
/**
@@ -899,7 +899,10 @@ export const calculateWindowAdjustment = (
* the trigger, then we should not adjust top
* margins.
*/
if (triggerTop + triggerHeight + contentHeight + verticalSafeAreaApprox > bodyHeight && (side === 'top' || side === 'bottom')) {
if (
triggerTop + triggerHeight + contentHeight + verticalSafeAreaApprox > bodyHeight &&
(side === 'top' || side === 'bottom')
) {
if (triggerTop - contentHeight > 0) {
/**
* While we strive to align the popover with the trigger