fix: backspace to previous word in stop on letter leaving type hints (NadAlaba) (#5466)

* fix: fix backspace to previous word in stop on letter (NadAlaba)

* revert to calling updateWordElement() in all cases after backspacing
This commit is contained in:
Nad Alaba 2024-06-05 16:25:48 +03:00 committed by GitHub
parent 37c256b037
commit a1c805cc28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 (