Skip to content

Commit

Permalink
fix(modal): swipeable modal now works in firefox (#20714)
Browse files Browse the repository at this point in the history
fixes #20706
  • Loading branch information
liamdebeasi committed Mar 6, 2020
1 parent 22d5256 commit 7d260b9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion core/src/components/modal/animations/ios.enter.ts
Expand Up @@ -31,7 +31,13 @@ export const iosEnterAnimation = (
.addAnimation([backdropAnimation, wrapperAnimation]);

if (presentingEl) {
const modalTransform = (presentingEl.tagName === 'ION-MODAL' && (presentingEl as HTMLIonModalElement).presentingElement !== undefined) ? '-10px' : 'max(30px, var(--ion-safe-area-top))';
/**
* Fallback for browsers that does not support `max()` (ex: Firefox)
* No need to wrry about statusbar padding since engines like Gecko
* are not used as the engine for standlone Cordova/Capacitor apps
*/
const transformOffset = (!CSS.supports('width', 'max(0px, 1px)')) ? '30px' : 'max(30px, var(--ion-safe-area-top))';
const modalTransform = (presentingEl.tagName === 'ION-MODAL' && (presentingEl as HTMLIonModalElement).presentingElement !== undefined) ? '-10px' : transformOffset;
const bodyEl = document.body;
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/modal/animations/ios.leave.ts
Expand Up @@ -27,7 +27,8 @@ export const iosLeaveAnimation = (
.addAnimation([backdropAnimation, wrapperAnimation]);

if (presentingEl) {
const modalTransform = (presentingEl.tagName === 'ION-MODAL' && (presentingEl as HTMLIonModalElement).presentingElement !== undefined) ? '-10px' : 'max(30px, var(--ion-safe-area-top))';
const transformOffset = (!CSS.supports('width', 'max(0px, 1px)')) ? '30px' : 'max(30px, var(--ion-safe-area-top))';
const modalTransform = (presentingEl.tagName === 'ION-MODAL' && (presentingEl as HTMLIonModalElement).presentingElement !== undefined) ? '-10px' : transformOffset;
const bodyEl = document.body;
const currentPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
const presentingAnimation = createAnimation()
Expand Down
8 changes: 7 additions & 1 deletion core/src/components/modal/modal.ios.scss
Expand Up @@ -28,5 +28,11 @@

:host(.modal-card) .modal-wrapper {
@include border-radius($modal-ios-border-radius, $modal-ios-border-radius, 0, 0);
height: calc(100% - max(30px, var(--ion-safe-area-top)) - 10px);
height: calc(100% - 40px);
}

@supports (width: max(0px, 1px)) {
:host(.modal-card) .modal-wrapper {
height: calc(100% - max(30px, var(--ion-safe-area-top)) - 10px);
}
}

0 comments on commit 7d260b9

Please sign in to comment.