@@ -98,7 +98,11 @@ export const createSheetGesture = (
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
100
const el = baseEl as HTMLIonModalElement & { focusTrap ?: boolean ; showBackdrop ?: boolean } ;
101
- if ( el . focusTrap === false || el . showBackdrop === false ) {
101
+ const focusTrapAttr = el . getAttribute ?.( 'focus-trap' ) ;
102
+ const showBackdropAttr = el . getAttribute ?.( 'show-backdrop' ) ;
103
+ const focusTrapDisabled = el . focusTrap === false || focusTrapAttr === 'false' ;
104
+ const backdropDisabled = el . showBackdrop === false || showBackdropAttr === 'false' ;
105
+ if ( focusTrapDisabled || backdropDisabled ) {
102
106
return ;
103
107
}
104
108
baseEl . style . setProperty ( 'pointer-events' , 'auto' ) ;
@@ -241,10 +245,12 @@ export const createSheetGesture = (
241
245
* ion-backdrop and .modal-wrapper always have pointer-events: auto
242
246
* applied, so the modal content can still be interacted with.
243
247
*/
244
- const shouldEnableBackdrop =
245
- currentBreakpoint > backdropBreakpoint &&
246
- ( baseEl as HTMLIonModalElement & { focusTrap ?: boolean } ) . focusTrap !== false &&
247
- ( baseEl as HTMLIonModalElement & { showBackdrop ?: boolean } ) . showBackdrop !== false ;
248
+ const modalEl = baseEl as HTMLIonModalElement & { focusTrap ?: boolean ; showBackdrop ?: boolean } ;
249
+ const focusTrapAttr = modalEl . getAttribute ?.( 'focus-trap' ) ;
250
+ const showBackdropAttr = modalEl . getAttribute ?.( 'show-backdrop' ) ;
251
+ const focusTrapDisabled = modalEl . focusTrap === false || focusTrapAttr === 'false' ;
252
+ const backdropDisabled = modalEl . showBackdrop === false || showBackdropAttr === 'false' ;
253
+ const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint && ! focusTrapDisabled && ! backdropDisabled ;
248
254
if ( shouldEnableBackdrop ) {
249
255
enableBackdrop ( ) ;
250
256
} else {
@@ -591,10 +597,16 @@ export const createSheetGesture = (
591
597
* Backdrop should become enabled
592
598
* after the backdropBreakpoint value
593
599
*/
600
+ const modalEl = baseEl as HTMLIonModalElement & {
601
+ focusTrap ?: boolean ;
602
+ showBackdrop ?: boolean ;
603
+ } ;
604
+ const focusTrapAttr = modalEl . getAttribute ?.( 'focus-trap' ) ;
605
+ const showBackdropAttr = modalEl . getAttribute ?.( 'show-backdrop' ) ;
606
+ const focusTrapDisabled = modalEl . focusTrap === false || focusTrapAttr === 'false' ;
607
+ const backdropDisabled = modalEl . showBackdrop === false || showBackdropAttr === 'false' ;
594
608
const shouldEnableBackdrop =
595
- currentBreakpoint > backdropBreakpoint &&
596
- ( baseEl as HTMLIonModalElement & { focusTrap ?: boolean } ) . focusTrap !== false &&
597
- ( baseEl as HTMLIonModalElement & { showBackdrop ?: boolean } ) . showBackdrop !== false ;
609
+ currentBreakpoint > backdropBreakpoint && ! focusTrapDisabled && ! backdropDisabled ;
598
610
if ( shouldEnableBackdrop ) {
599
611
enableBackdrop ( ) ;
600
612
} else {
0 commit comments