From 3454da18e023b3062e36e63a943dc60e791c2f10 Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 18 Nov 2025 17:23:44 +0100 Subject: [PATCH 1/2] fix(animation modal): animations stacking unnecessairly --- frontend/src/ts/utils/animated-modal.ts | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/frontend/src/ts/utils/animated-modal.ts b/frontend/src/ts/utils/animated-modal.ts index d3ca0fd0fe80..4cf42771d7b4 100644 --- a/frontend/src/ts/utils/animated-modal.ts +++ b/frontend/src/ts/utils/animated-modal.ts @@ -248,6 +248,10 @@ export default class AnimatedModal< this.focusFirstInput(options?.focusFirstInput); }, 1); + const hasModalAnimation = + (options?.customAnimation?.modal ?? + this.customHideAnimations?.modal) !== undefined; + const modalAnimation = options?.customAnimation?.modal ?? this.customShowAnimations?.modal ?? { opacity: [0, 1], @@ -269,10 +273,14 @@ export default class AnimatedModal< : options?.animationMode ?? "both"; if (animationMode === "both" || animationMode === "none") { - animate(this.modalEl, { - ...modalAnimation, - duration: animationMode === "none" ? 0 : modalAnimationDuration, - }); + if (hasModalAnimation) { + animate(this.modalEl, { + ...modalAnimation, + duration: animationMode === "none" ? 0 : modalAnimationDuration, + }); + } else { + this.modalEl.style.opacity = "1"; + } animate(this.wrapperEl, { ...wrapperAnimation, @@ -322,6 +330,10 @@ export default class AnimatedModal< await options?.beforeAnimation?.(this.modalEl); + const hasModalAnimation = + (options?.customAnimation?.modal ?? + this.customHideAnimations?.modal) !== undefined; + const modalAnimation = options?.customAnimation?.modal ?? this.customHideAnimations?.modal ?? { opacity: [1, 0], @@ -351,10 +363,14 @@ export default class AnimatedModal< : options?.animationMode ?? "both"; if (animationMode === "both" || animationMode === "none") { - animate(this.modalEl, { - ...modalAnimation, - duration: animationMode === "none" ? 0 : modalAnimationDuration, - }); + if (hasModalAnimation) { + animate(this.modalEl, { + ...modalAnimation, + duration: animationMode === "none" ? 0 : modalAnimationDuration, + }); + } else { + this.modalEl.style.opacity = "1"; + } animate(this.wrapperEl, { ...wrapperAnimation, From 5a9038cfeffdda6d02ff6626f178c52b8c9d83e2 Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 18 Nov 2025 20:01:55 +0100 Subject: [PATCH 2/2] chore: move code --- frontend/src/ts/event-handlers/global.ts | 10 ++++++++++ frontend/src/ts/ui.ts | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/ts/event-handlers/global.ts b/frontend/src/ts/event-handlers/global.ts index 7e3434bf6ce4..8941c6254f4a 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 af93a4c30370..414d7f0be9e3 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 (