diff --git a/frontend/src/ts/event-handlers/global.ts b/frontend/src/ts/event-handlers/global.ts index 7e3434bf6..8941c6254 100644 --- a/frontend/src/ts/event-handlers/global.ts +++ b/frontend/src/ts/event-handlers/global.ts @@ -29,6 +29,16 @@ document.addEventListener("keydown", async (e) => { } }); +//stop space scrolling +window.addEventListener("keydown", function (e) { + if ( + e.code === "Space" && + (e.target === document.body || (e.target as HTMLElement)?.id === "result") + ) { + e.preventDefault(); + } +}); + window.onerror = function (message, url, line, column, error): void { if (Misc.isDevEnvironment()) { Notifications.add(error?.message ?? "Undefined message", -1, { diff --git a/frontend/src/ts/ui.ts b/frontend/src/ts/ui.ts index af93a4c30..414d7f0be 100644 --- a/frontend/src/ts/ui.ts +++ b/frontend/src/ts/ui.ts @@ -65,16 +65,6 @@ if (isDevEnvironment()) { ); } -//stop space scrolling -window.addEventListener("keydown", function (e) { - if ( - e.code === "Space" && - (e.target === document.body || (e.target as HTMLElement)?.id === "result") - ) { - e.preventDefault(); - } -}); - window.addEventListener("beforeunload", (event) => { // Cancel the event as stated by the standard. if (