fix: out of focus warning sometimes showing even though words were focused

This commit is contained in:
Miodec 2025-12-16 10:55:37 +01:00
parent ee2e680ffe
commit 65aadb7e89
3 changed files with 5 additions and 3 deletions

View file

@ -64,7 +64,7 @@ function removeCommandlineBackground(): void {
function addCommandlineBackground(): void {
qs("#commandLine")?.removeClass("noBackground");
if (Config.showOutOfFocusWarning && !isInputElementFocused()) {
if (!isInputElementFocused()) {
OutOfFocus.show();
}
}

View file

@ -1,4 +1,5 @@
import * as Misc from "../utils/misc";
import Config from "../config";
const outOfFocusTimeouts: (number | NodeJS.Timeout)[] = [];
@ -11,6 +12,7 @@ export function hide(): void {
}
export function show(): void {
if (!Config.showOutOfFocusWarning) return;
outOfFocusTimeouts.push(
setTimeout(() => {
$("#words, #compositionDisplay")

View file

@ -465,7 +465,7 @@ function updateWordWrapperClasses(): void {
void updateHintsPositionDebounced();
Caret.updatePosition();
if (document.activeElement !== getInputElement()) {
if (!isInputElementFocused()) {
OutOfFocus.show();
}
}
@ -1998,7 +1998,7 @@ $("#wordsInput").on("focus", (e) => {
});
$("#wordsInput").on("focusout", () => {
if (!TestState.resultVisible && Config.showOutOfFocusWarning) {
if (!isInputElementFocused()) {
OutOfFocus.show();
}
Caret.hide();