diff --git a/core/src/components/modal/gestures/sheet.ts b/core/src/components/modal/gestures/sheet.ts index 0e3fca6b8b..0db3cbeb4f 100644 --- a/core/src/components/modal/gestures/sheet.ts +++ b/core/src/components/modal/gestures/sheet.ts @@ -1,5 +1,6 @@ import { createGesture } from '@utils/gesture'; import { clamp, raf } from '@utils/helpers'; +import { FOCUS_TRAP_DISABLE_CLASS } from '@utils/overlays'; import type { Animation } from '../../../interface'; import type { GestureDetail } from '../../../utils/gesture'; @@ -91,7 +92,7 @@ export const createSheetGesture = ( * as inputs should not be focusable outside * the sheet. */ - baseEl.classList.remove('ion-disable-focus-trap'); + baseEl.classList.remove(FOCUS_TRAP_DISABLE_CLASS); }; const disableBackdrop = () => { @@ -105,7 +106,7 @@ export const createSheetGesture = ( * Adding this class disables focus trapping * for the sheet temporarily. */ - baseEl.classList.add('ion-disable-focus-trap'); + baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS); }; /** diff --git a/core/src/utils/overlays.ts b/core/src/utils/overlays.ts index cf1761ce28..e69bd49dcd 100644 --- a/core/src/utils/overlays.ts +++ b/core/src/utils/overlays.ts @@ -199,7 +199,7 @@ const trapKeyboardFocus = (ev: Event, doc: Document) => { * behind the sheet should be focusable until * the backdrop is enabled. */ - if (lastOverlay.classList.contains('ion-disable-focus-trap')) { + if (lastOverlay.classList.contains(FOCUS_TRAP_DISABLE_CLASS)) { return; } @@ -990,3 +990,5 @@ const revealOverlaysToScreenReaders = () => { } } }; + +export const FOCUS_TRAP_DISABLE_CLASS = 'ion-disable-focus-trap';