refactor: assign class to const

This commit is contained in:
Liam DeBeasi
2024-04-11 10:26:47 -04:00
parent 2220d83d32
commit 1a4494199e
2 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { createGesture } from '@utils/gesture'; import { createGesture } from '@utils/gesture';
import { clamp, raf } from '@utils/helpers'; import { clamp, raf } from '@utils/helpers';
import { FOCUS_TRAP_DISABLE_CLASS } from '@utils/overlays';
import type { Animation } from '../../../interface'; import type { Animation } from '../../../interface';
import type { GestureDetail } from '../../../utils/gesture'; import type { GestureDetail } from '../../../utils/gesture';
@ -91,7 +92,7 @@ export const createSheetGesture = (
* as inputs should not be focusable outside * as inputs should not be focusable outside
* the sheet. * the sheet.
*/ */
baseEl.classList.remove('ion-disable-focus-trap'); baseEl.classList.remove(FOCUS_TRAP_DISABLE_CLASS);
}; };
const disableBackdrop = () => { const disableBackdrop = () => {
@ -105,7 +106,7 @@ export const createSheetGesture = (
* Adding this class disables focus trapping * Adding this class disables focus trapping
* for the sheet temporarily. * for the sheet temporarily.
*/ */
baseEl.classList.add('ion-disable-focus-trap'); baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
}; };
/** /**

View File

@ -199,7 +199,7 @@ const trapKeyboardFocus = (ev: Event, doc: Document) => {
* behind the sheet should be focusable until * behind the sheet should be focusable until
* the backdrop is enabled. * the backdrop is enabled.
*/ */
if (lastOverlay.classList.contains('ion-disable-focus-trap')) { if (lastOverlay.classList.contains(FOCUS_TRAP_DISABLE_CLASS)) {
return; return;
} }
@ -990,3 +990,5 @@ const revealOverlaysToScreenReaders = () => {
} }
} }
}; };
export const FOCUS_TRAP_DISABLE_CLASS = 'ion-disable-focus-trap';