Skip to content

Commit 7c24b1f

Browse files
kumibrrthetaPC
andcommitted
chore(modal): minor fixes
Co-authored-by: Maria Hutt <[email protected]>
1 parent 991e02a commit 7c24b1f

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

core/src/components/modal/animations/ios.leave.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const iosLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptio
4040
}
4141

4242
/**
43-
* If scrollAtEdge is disabled, we need toß swap
43+
* If scrollAtEdge is disabled, we need to swap
4444
* the visibility to the original, so the footer
4545
* dismisses with the modal and doesn't stay
4646
* until the modal is removed from the DOM.
@@ -56,7 +56,7 @@ export const iosLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptio
5656
clonedFooter.setAttribute('aria-hidden', 'true');
5757

5858
const page = baseEl.querySelector('.ion-page') as HTMLElement;
59-
page.style.setProperty('padding-bottom', `0`);
59+
page.style.removeProperty('padding-bottom');
6060
}
6161
});
6262

core/src/components/modal/animations/md.leave.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const mdLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOption
5656
clonedFooter.setAttribute('aria-hidden', 'true');
5757

5858
const page = baseEl.querySelector('.ion-page') as HTMLElement;
59-
page.style.setProperty('padding-bottom', `0`);
59+
page.style.removeProperty('padding-bottom');
6060
}
6161
});
6262

core/src/components/modal/gestures/sheet.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,32 +116,31 @@ export const createSheetGesture = (
116116
baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
117117
};
118118

119-
120119
/**
121120
* Used when `scrollAtEdge` is disabled.
122121
* Changes the footer that is currently visible
123122
* @param footer - The footer to show
124123
*/
125124
const swapFooterVisibility = (footer: 'original' | 'cloned') => {
126-
const footerToHide = footer === 'original' ?
127-
wrapperEl.nextElementSibling as HTMLIonFooterElement :
128-
baseEl.querySelector('ion-footer') as HTMLIonFooterElement;
129-
const footerToShow = footer === 'original' ?
130-
baseEl.querySelector('ion-footer') as HTMLIonFooterElement :
131-
wrapperEl.nextElementSibling as HTMLIonFooterElement;
125+
const originalFooter = baseEl.querySelector('ion-footer') as HTMLIonFooterElement;
126+
const clonedFooter = wrapperEl.nextElementSibling as HTMLIonFooterElement;
127+
const footerToHide = footer === 'original' ? clonedFooter : originalFooter;
128+
const footerToShow = footer === 'original' ? originalFooter : clonedFooter;
132129

133130
footerToShow.style.removeProperty('display');
134131
footerToShow.removeAttribute('aria-hidden');
135132

136-
const pagePadding =
137-
footer === 'original' ? 0 : footerToShow.clientHeight;
138-
139133
const page = baseEl.querySelector('.ion-page') as HTMLElement;
140-
page.style.setProperty('padding-bottom', `${pagePadding}px`);
134+
if (footer === 'original') {
135+
page.style.removeProperty('padding-bottom');
136+
} else {
137+
const pagePadding = footerToShow.clientHeight;
138+
page.style.setProperty('padding-bottom', `${pagePadding}px`);
139+
}
141140

142141
footerToHide.style.setProperty('display', 'none');
143142
footerToHide.setAttribute('aria-hidden', 'true');
144-
}
143+
};
145144

146145
/**
147146
* After the entering animation completes,
@@ -236,7 +235,7 @@ export const createSheetGesture = (
236235
* and doesn't stay on the screen after the modal is gone.
237236
*/
238237
if (!scrollAtEdge) {
239-
swapFooterVisibility('original')
238+
swapFooterVisibility('original');
240239
}
241240

242241
/**

0 commit comments

Comments
 (0)