Skip to content

Commit

Permalink
FileView: disable hotkeys when a dialog is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
warpdesign committed May 3, 2024
1 parent 4bb3569 commit 73c7dd5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/FileView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useRef, MutableRefObject } from 'react'
import { observer } from 'mobx-react'
import { ContextMenu2, ContextMenu2ChildrenProps, ContextMenu2ContentProps } from '@blueprintjs/popover2'
import { HotkeysTarget2, Classes } from '@blueprintjs/core'
import { HotkeysTarget2, Classes, HotkeyConfig } from '@blueprintjs/core'
import { useTranslation } from 'react-i18next'
import classNames from 'classnames'
import { ipcRenderer } from 'electron'
Expand Down Expand Up @@ -250,7 +250,7 @@ const FileView = observer(({ hide }: Props) => {
}

const onOpenFile = (e: KeyboardEvent): void => {
if (isViewActive && cursor) {
if (isViewActive && cursor && shouldCatchEvent(e)) {
openFileOrDirectory(cursor, isMac ? e.altKey : e.shiftKey)
}
}
Expand All @@ -266,7 +266,7 @@ const FileView = observer(({ hide }: Props) => {
}
}

const hotkeys = [
const hotkeys: HotkeyConfig[] = [
{
global: true,
combo: 'mod + o',
Expand All @@ -285,7 +285,7 @@ const FileView = observer(({ hide }: Props) => {
global: true,
combo: 'mod + i',
label: t('SHORTCUT.ACTIVE_VIEW.SELECT_INVERT'),
onKeyDown: () => isViewActive && onInvertSelection(cache),
onKeyDown: (e) => shouldCatchEvent(e) && isViewActive && onInvertSelection(cache),
group: t('SHORTCUT.GROUP.ACTIVE_VIEW'),
},
...(!isMac || window.ENV.CY
Expand All @@ -294,11 +294,11 @@ const FileView = observer(({ hide }: Props) => {
global: true,
combo: 'mod + a',
label: t('SHORTCUT.ACTIVE_VIEW.SELECT_ALL'),
onKeyDown: () => {
viewState.isActive && onSelectAll(cache)
onKeyDown: (e) => {
shouldCatchEvent(e) && viewState.isActive && onSelectAll(cache)
},
group: t('SHORTCUT.GROUP.ACTIVE_VIEW'),
},
} as HotkeyConfig,
]
: []),
]
Expand Down

0 comments on commit 73c7dd5

Please sign in to comment.