mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-29 03:20:46 +08:00
fix: out of focus warning sometimes showing even though words were focused
This commit is contained in:
parent
ee2e680ffe
commit
65aadb7e89
3 changed files with 5 additions and 3 deletions
|
|
@ -64,7 +64,7 @@ function removeCommandlineBackground(): void {
|
|||
|
||||
function addCommandlineBackground(): void {
|
||||
qs("#commandLine")?.removeClass("noBackground");
|
||||
if (Config.showOutOfFocusWarning && !isInputElementFocused()) {
|
||||
if (!isInputElementFocused()) {
|
||||
OutOfFocus.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue