From 3454da18e023b3062e36e63a943dc60e791c2f10 Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 18 Nov 2025 17:23:44 +0100 Subject: [PATCH] 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 d3ca0fd0f..4cf42771d 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,