mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-30 18:57:27 +08:00
refactor: better logs when returning out of a keydown event
This commit is contained in:
parent
1714dfe162
commit
05fc90373f
1 changed files with 14 additions and 3 deletions
|
|
@ -822,9 +822,17 @@ function handleTab(event: JQuery.KeyDownEvent, popupVisible: boolean): void {
|
|||
let lastBailoutAttempt = -1;
|
||||
|
||||
$(document).on("keydown", async (event) => {
|
||||
if (ActivePage.get() === "loading") return;
|
||||
if (ActivePage.get() === "loading") {
|
||||
console.debug("Ignoring keydown event on loading page.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IgnoredKeys.includes(event.key)) return;
|
||||
if (IgnoredKeys.includes(event.key)) {
|
||||
console.debug(
|
||||
`Key ${event.key} is on the list of ignored keys. Stopping keydown event.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
//autofocus
|
||||
const wordsFocused: boolean = $("#wordsInput").is(":focus");
|
||||
|
|
@ -836,7 +844,10 @@ $(document).on("keydown", async (event) => {
|
|||
|
||||
const cookiePopupVisible = CookiePopup.isVisible();
|
||||
|
||||
if (cookiePopupVisible) return;
|
||||
if (cookiePopupVisible) {
|
||||
console.debug("Ignoring keydown event because cookie popup is visible.");
|
||||
return;
|
||||
}
|
||||
|
||||
const allowTyping: boolean =
|
||||
pageTestActive &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue