From 34e971bc42713fddfb75c2ff44bc119069198905 Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 28 Nov 2025 21:36:49 +0100 Subject: [PATCH] chore: add guards to before delete --- frontend/src/ts/input/handlers/before-delete.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/ts/input/handlers/before-delete.ts b/frontend/src/ts/input/handlers/before-delete.ts index a16d1c0a6..79fb28d77 100644 --- a/frontend/src/ts/input/handlers/before-delete.ts +++ b/frontend/src/ts/input/handlers/before-delete.ts @@ -4,12 +4,23 @@ import * as TestState from "../../test/test-state"; import * as TestWords from "../../test/test-words"; import { getInputElementValue } from "../input-element"; import * as TestUI from "../../test/test-ui"; +import { isAwaitingNextWord } from "../state"; export function onBeforeDelete(event: InputEvent): void { if (!TestState.isActive) { event.preventDefault(); return; } + if (TestState.testRestarting) { + return; + } + if (isAwaitingNextWord()) { + return; + } + if (TestUI.resultCalculating) { + return; + } + const { inputValue } = getInputElementValue(); const inputIsEmpty = inputValue === "";