diff --git a/frontend/src/ts/constants/ignored-keys.ts b/frontend/src/ts/constants/ignored-keys.ts new file mode 100644 index 000000000..40680705c --- /dev/null +++ b/frontend/src/ts/constants/ignored-keys.ts @@ -0,0 +1,8 @@ +export const IgnoredKeys = [ + "MediaTrackNext", + "MediaTrackPrevious", + "MediaPlayPause", + "AudioVolumeUp", + "AudioVolumeDown", + "AudioVolumeMute", +]; diff --git a/frontend/src/ts/controllers/input-controller.ts b/frontend/src/ts/controllers/input-controller.ts index 6c1ddf15e..6581054f6 100644 --- a/frontend/src/ts/controllers/input-controller.ts +++ b/frontend/src/ts/controllers/input-controller.ts @@ -30,6 +30,7 @@ import * as TestWords from "../test/test-words"; import * as Hangul from "hangul-js"; import * as CustomTextState from "../states/custom-text-name"; import { navigate } from "../observables/navigate-event"; +import { IgnoredKeys } from "../constants/ignored-keys"; let dontInsertSpace = false; let correctShiftUsed = true; @@ -765,6 +766,8 @@ function handleTab(event: JQuery.KeyDownEvent, popupVisible: boolean): void { $(document).keydown(async (event) => { if (ActivePage.get() == "loading") return; + if (IgnoredKeys.includes(event.key)) return; + //autofocus const wordsFocused: boolean = $("#wordsInput").is(":focus"); const pageTestActive: boolean = ActivePage.get() === "test"; @@ -961,6 +964,8 @@ $("#wordsInput").keyup((event) => { return; } + if (IgnoredKeys.includes(event.key)) return; + if (TestUI.resultVisible) return; const now: number = performance.now(); if (TestInput.keypressTimings.duration.current !== -1) {