mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(popover): apply safe area adjustments for edge positioning in md mode
This commit is contained in:
@@ -11,6 +11,12 @@ import {
|
||||
} from '../utils';
|
||||
|
||||
const POPOVER_IOS_BODY_PADDING = 5;
|
||||
/**
|
||||
* Extra margin around viewport edges for safe area detection.
|
||||
* When popover is within this distance of an edge, safe area
|
||||
* CSS variables will be applied to prevent overlap with system UI.
|
||||
*/
|
||||
const POPOVER_IOS_SAFE_AREA_MARGIN = 25;
|
||||
|
||||
/**
|
||||
* iOS Popover Enter Animation
|
||||
@@ -53,7 +59,7 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
|
||||
);
|
||||
|
||||
const padding = size === 'cover' ? 0 : POPOVER_IOS_BODY_PADDING;
|
||||
const margin = size === 'cover' ? 0 : 25;
|
||||
const margin = size === 'cover' ? 0 : POPOVER_IOS_SAFE_AREA_MARGIN;
|
||||
|
||||
const {
|
||||
originX,
|
||||
|
||||
@@ -5,6 +5,12 @@ import type { Animation } from '../../../interface';
|
||||
import { calculateWindowAdjustment, getPopoverDimensions, getPopoverPosition } from '../utils';
|
||||
|
||||
const POPOVER_MD_BODY_PADDING = 12;
|
||||
/**
|
||||
* Extra margin around viewport edges for safe area detection.
|
||||
* When popover is within this distance of an edge, safe area
|
||||
* CSS variables will be applied to prevent overlap with system UI.
|
||||
*/
|
||||
const POPOVER_MD_SAFE_AREA_MARGIN = 25;
|
||||
|
||||
/**
|
||||
* Md Popover Enter Animation
|
||||
@@ -47,6 +53,8 @@ export const mdEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
|
||||
|
||||
const padding = size === 'cover' ? 0 : POPOVER_MD_BODY_PADDING;
|
||||
|
||||
const margin = size === 'cover' ? 0 : POPOVER_MD_SAFE_AREA_MARGIN;
|
||||
|
||||
const {
|
||||
originX,
|
||||
originY,
|
||||
@@ -66,7 +74,7 @@ export const mdEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
|
||||
bodyHeight,
|
||||
contentWidth,
|
||||
contentHeight,
|
||||
0,
|
||||
margin,
|
||||
results.originX,
|
||||
results.originY,
|
||||
results.referenceCoordinates
|
||||
|
||||
Reference in New Issue
Block a user