From 22cc737f8e056067d64ca3ba4d574d0b8a97fd68 Mon Sep 17 00:00:00 2001 From: He4eT Date: Sat, 3 Jun 2023 23:14:59 +0300 Subject: [PATCH] InputBox: ignore keyboard shortcuts --- src/components/Player/InputBox/InputBox.jsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/Player/InputBox/InputBox.jsx b/src/components/Player/InputBox/InputBox.jsx index cc07765..11afb6e 100644 --- a/src/components/Player/InputBox/InputBox.jsx +++ b/src/components/Player/InputBox/InputBox.jsx @@ -35,6 +35,17 @@ const keyNames = { } /* eslint-enable */ +const hasModifier = (event) => { + const modifiers = [ + event.altKey, + event.ctrlKey, + event.metaKey, + event.shiftKey, + ] + + return modifiers.some((modifier) => modifier === true) +} + export default function InputBox ({ inputType, windows, @@ -75,6 +86,8 @@ export default function InputBox ({ : charHandlerDefault)(event) const charHandlerDefault = (event) => { + if (hasModifier(event)) { return undefined } + event.preventDefault() const key =