@@ -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