@@ -19,7 +19,7 @@ const createLeaveAnimation = () => {
1919 * iOS Modal Leave Animation
2020 */
2121export const iosLeaveAnimation = ( baseEl : HTMLElement , opts : ModalAnimationOptions , duration = 500 ) : Animation => {
22- const { presentingEl, currentBreakpoint } = opts ;
22+ const { presentingEl, currentBreakpoint, scrollAtEdge } = opts ;
2323 const root = getElementRoot ( baseEl ) ;
2424 const { wrapperAnimation, backdropAnimation } =
2525 currentBreakpoint !== undefined ? createSheetLeaveAnimation ( opts ) : createLeaveAnimation ( ) ;
@@ -32,7 +32,33 @@ export const iosLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptio
3232 . addElement ( baseEl )
3333 . easing ( 'cubic-bezier(0.32,0.72,0,1)' )
3434 . duration ( duration )
35- . addAnimation ( wrapperAnimation ) ;
35+ . addAnimation ( wrapperAnimation )
36+ . beforeAddWrite ( ( ) => {
37+ if ( scrollAtEdge ) {
38+ // Scroll can only be done when the modal is fully expanded.
39+ return ;
40+ }
41+
42+ /**
43+ * If scrollAtEdge is disabled, we need toß swap
44+ * the visibility to the original, so the footer
45+ * dismisses with the modal and doesn't stay
46+ * until the modal is removed from the DOM.
47+ */
48+ const ionFooter = baseEl . querySelector ( 'ion-footer' ) ;
49+ if ( ionFooter ) {
50+ const clonedFooter = baseEl . shadowRoot ! . querySelector ( 'ion-footer' ) ! ;
51+
52+ ionFooter . style . removeProperty ( 'display' ) ;
53+ ionFooter . removeAttribute ( 'aria-hidden' ) ;
54+
55+ clonedFooter . style . setProperty ( 'display' , 'none' ) ;
56+ clonedFooter . setAttribute ( 'aria-hidden' , 'true' ) ;
57+
58+ const page = baseEl . querySelector ( '.ion-page' ) as HTMLElement ;
59+ page . style . setProperty ( 'padding-bottom' , `0` ) ;
60+ }
61+ } ) ;
3662
3763 if ( presentingEl ) {
3864 const isMobile = window . innerWidth < 768 ;
0 commit comments