@@ -98,7 +98,11 @@ export const createSheetGesture = (
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
100100 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 ) {
102106 return ;
103107 }
104108 baseEl . style . setProperty ( 'pointer-events' , 'auto' ) ;
@@ -241,10 +245,12 @@ export const createSheetGesture = (
241245 * ion-backdrop and .modal-wrapper always have pointer-events: auto
242246 * applied, so the modal content can still be interacted with.
243247 */
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 ;
248254 if ( shouldEnableBackdrop ) {
249255 enableBackdrop ( ) ;
250256 } else {
@@ -591,10 +597,16 @@ export const createSheetGesture = (
591597 * Backdrop should become enabled
592598 * after the backdropBreakpoint value
593599 */
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' ;
594608 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 ;
598610 if ( shouldEnableBackdrop ) {
599611 enableBackdrop ( ) ;
600612 } else {
0 commit comments