mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
refactor: assign class to const
This commit is contained in:
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -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';
|
||||
|
||||
Reference in New Issue
Block a user