diff --git a/frontend/src/ts/controllers/input-controller.ts b/frontend/src/ts/controllers/input-controller.ts index c6a6389b8..27f286832 100644 --- a/frontend/src/ts/controllers/input-controller.ts +++ b/frontend/src/ts/controllers/input-controller.ts @@ -120,13 +120,12 @@ function backspaceToPrevious(): void { return; } + const wordElements = document.querySelectorAll("#words > .word"); if ( (TestInput.input.history[TestWords.words.currentIndex - 1] == TestWords.words.get(TestWords.words.currentIndex - 1) && !Config.freedomMode) || - $($(".word")[TestWords.words.currentIndex - 1] as HTMLElement).hasClass( - "hidden" - ) + wordElements[TestWords.words.currentIndex - 1]?.classList.contains("hidden") ) { return; } @@ -135,6 +134,14 @@ function backspaceToPrevious(): void { return; } + const incorrectLetterBackspaced = + wordElements[TestWords.words.currentIndex]?.children[0]?.classList.contains( + "incorrect" + ); + if (Config.stopOnError === "letter" && incorrectLetterBackspaced) { + void TestUI.updateWordElement(); + } + TestInput.input.current = TestInput.input.popHistory(); TestInput.corrected.popHistory(); if (