@@ -97,8 +97,10 @@ export const createSheetGesture = (
97
97
const enableBackdrop = ( ) => {
98
98
// Respect explicit opt-out of focus trapping/backdrop interactions
99
99
// 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 ) {
102
104
return ;
103
105
}
104
106
baseEl . style . setProperty ( 'pointer-events' , 'auto' ) ;
@@ -241,10 +243,10 @@ export const createSheetGesture = (
241
243
* ion-backdrop and .modal-wrapper always have pointer-events: auto
242
244
* applied, so the modal content can still be interacted with.
243
245
*/
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 ;
248
250
if ( shouldEnableBackdrop ) {
249
251
enableBackdrop ( ) ;
250
252
} else {
@@ -591,10 +593,14 @@ export const createSheetGesture = (
591
593
* Backdrop should become enabled
592
594
* after the backdropBreakpoint value
593
595
*/
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' ;
594
602
const shouldEnableBackdrop =
595
- currentBreakpoint > backdropBreakpoint &&
596
- ( baseEl as HTMLIonModalElement & { focusTrap ?: boolean } ) . focusTrap !== false &&
597
- ( baseEl as HTMLIonModalElement & { showBackdrop ?: boolean } ) . showBackdrop !== false ;
603
+ currentBreakpoint > backdropBreakpoint && ! focusTrapDisabled && ! backdropDisabled ;
598
604
if ( shouldEnableBackdrop ) {
599
605
enableBackdrop ( ) ;
600
606
} else {
0 commit comments