From 12e83c53f403de781f4d4b978009f55f4d6d5d1c Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 26 Sep 2023 14:18:34 +0100 Subject: [PATCH] impr(typing): preventing arrow navigation and text selection of the test input closes #4671 --- frontend/src/styles/test.scss | 1 + frontend/src/ts/controllers/input-controller.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/frontend/src/styles/test.scss b/frontend/src/styles/test.scss index 5c5e8e67f..409e8594b 100644 --- a/frontend/src/styles/test.scss +++ b/frontend/src/styles/test.scss @@ -478,6 +478,7 @@ z-index: -1; cursor: default; pointer-events: none; + user-select: none !important; } #capsWarning { diff --git a/frontend/src/ts/controllers/input-controller.ts b/frontend/src/ts/controllers/input-controller.ts index a7658cecd..fbb6b4249 100644 --- a/frontend/src/ts/controllers/input-controller.ts +++ b/frontend/src/ts/controllers/input-controller.ts @@ -1268,6 +1268,16 @@ $("#wordsInput").on("copy paste", (event) => { event.preventDefault(); }); +$("#wordsInput").on("select selectstart", (event) => { + event.preventDefault(); +}); + +$("#wordsInput").on("keydown", (event) => { + if (event.key.startsWith("Arrow")) { + event.preventDefault(); + } +}); + // Composing events $("#wordsInput").on("compositionstart", () => { if (Config.layout !== "default") return;