From fbfbe94d196a9c19601e28633ad363e252850da4 Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Wed, 15 Apr 2020 22:49:07 +0200 Subject: [PATCH] Prevent focussing filter when meta or ctrl key is pressed Fixes copy/paste problem --- app/src/components/Layout/SearchBar.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/components/Layout/SearchBar.tsx b/app/src/components/Layout/SearchBar.tsx index b9c40b8..add54d7 100644 --- a/app/src/components/Layout/SearchBar.tsx +++ b/app/src/components/Layout/SearchBar.tsx @@ -35,6 +35,7 @@ function SearchBar(props: { useGlobalKeyEventHandler(undefined, event => { const isCharacter = event.key.length === 1 + const isModifierKey = event.metaKey || event.ctrlKey const isAllowedControlCharacter = event.keyCode === KeyCodes.backspace || event.keyCode === KeyCodes.delete const tagNameBlacklist = ['INPUT', 'TEXTAREA', 'RADIO', 'CHECKBOX', 'OPTION', 'FORM'] @@ -43,6 +44,7 @@ function SearchBar(props: { if ( (isCharacter || isAllowedControlCharacter) && + !isModifierKey && !event.defaultPrevented && !hasFocus && tagElementIsNotBlacklisted &&