@@ -97,8 +97,10 @@ export const createSheetGesture = (
9797 const enableBackdrop = ( ) => {
9898 // Respect explicit opt-out of focus trapping/backdrop interactions
9999 // If focusTrap is false or showBackdrop is false, do not enable the backdrop or re-enable focus trap
100- const el = baseEl as HTMLIonModalElement & { focusTrap ?: boolean ; showBackdrop ?: boolean } ;
101- if ( el . focusTrap === false || el . showBackdrop === false ) {
100+ const el = baseEl as HTMLIonModalElement & { focusTrap ?: boolean | string ; showBackdrop ?: boolean | string } ;
101+ const focusTrapDisabled = el . focusTrap === false || el . focusTrap === 'false' ;
102+ const backdropDisabled = el . showBackdrop === false || el . showBackdrop === 'false' ;
103+ if ( focusTrapDisabled || backdropDisabled ) {
102104 return ;
103105 }
104106 baseEl . style . setProperty ( 'pointer-events' , 'auto' ) ;
@@ -241,10 +243,10 @@ export const createSheetGesture = (
241243 * ion-backdrop and .modal-wrapper always have pointer-events: auto
242244 * applied, so the modal content can still be interacted with.
243245 */
244- const shouldEnableBackdrop =
245- currentBreakpoint > backdropBreakpoint &&
246- ( baseEl as HTMLIonModalElement & { focusTrap ?: boolean } ) . focusTrap !== false &&
247- ( baseEl as HTMLIonModalElement & { showBackdrop ?: boolean } ) . showBackdrop !== false ;
246+ const modalEl = baseEl as HTMLIonModalElement & { focusTrap ?: boolean | string ; showBackdrop ?: boolean | string } ;
247+ const focusTrapDisabled = modalEl . focusTrap === false || modalEl . focusTrap === 'false' ;
248+ const backdropDisabled = modalEl . showBackdrop === false || modalEl . showBackdrop === ' false' ;
249+ const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint && ! focusTrapDisabled && ! backdropDisabled ;
248250 if ( shouldEnableBackdrop ) {
249251 enableBackdrop ( ) ;
250252 } else {
@@ -591,10 +593,13 @@ export const createSheetGesture = (
591593 * Backdrop should become enabled
592594 * after the backdropBreakpoint value
593595 */
594- const shouldEnableBackdrop =
595- currentBreakpoint > backdropBreakpoint &&
596- ( baseEl as HTMLIonModalElement & { focusTrap ?: boolean } ) . focusTrap !== false &&
597- ( baseEl as HTMLIonModalElement & { showBackdrop ?: boolean } ) . showBackdrop !== false ;
596+ const modalEl = baseEl as HTMLIonModalElement & {
597+ focusTrap ?: boolean | string ;
598+ showBackdrop ?: boolean | string ;
599+ } ;
600+ const focusTrapDisabled = modalEl . focusTrap === false || modalEl . focusTrap === 'false' ;
601+ const backdropDisabled = modalEl . showBackdrop === false || modalEl . showBackdrop === 'false' ;
602+ const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint && ! focusTrapDisabled && ! backdropDisabled ;
598603 if ( shouldEnableBackdrop ) {
599604 enableBackdrop ( ) ;
600605 } else {
0 commit comments