Skip to content

Commit 56985bd

Browse files
fix(#558 shortcuts): if a modal is open, do not process shortcuts
1 parent cf58201 commit 56985bd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/common/shortcut/shortcut.hook.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isMacOS, isWindowsOrLinux } from '@/common/helpers/platform.helpers';
2+
import { useModalDialogContext } from '@/core/providers';
23
import { useEffect } from 'react';
34

45
export interface ShortcutHookProps {
@@ -21,7 +22,13 @@ const useShortcut = ({
2122
callback,
2223
noModifier,
2324
}: ShortcutHookProps) => {
25+
const { modalDialog } = useModalDialogContext();
26+
2427
const handleKeyPress = (event: KeyboardEvent) => {
28+
if (modalDialog.isOpen) {
29+
return;
30+
}
31+
2532
const isMetaKeyPressed = event.getModifierState('Meta');
2633
const isCtrlKeyPressed = event.getModifierState('Control');
2734

0 commit comments

Comments
 (0)