From e3fa53f1648f97aa06dcb22648eb2d7f15acebe3 Mon Sep 17 00:00:00 2001 From: "Bajohr, Rayk" Date: Mon, 9 Feb 2026 15:12:09 +0100 Subject: [PATCH] refactor(modal): allow to disable dialog animation --- projects/element-ng/modal/si-modal.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/element-ng/modal/si-modal.component.ts b/projects/element-ng/modal/si-modal.component.ts index 4191c5fcc..571e3bf3f 100644 --- a/projects/element-ng/modal/si-modal.component.ts +++ b/projects/element-ng/modal/si-modal.component.ts @@ -16,6 +16,7 @@ import { viewChild, DOCUMENT } from '@angular/core'; +import { areAnimationsDisabled } from '@siemens/element-ng/common'; import { ModalRef } from './modalref'; @@ -26,7 +27,8 @@ import { ModalRef } from './modalref'; changeDetection: ChangeDetectionStrategy.OnPush }) export class SiModalComponent implements OnInit, AfterViewInit, OnDestroy { - protected modalRef = inject(ModalRef); + protected readonly modalRef = inject(ModalRef); + protected readonly isAnimated = !areAnimationsDisabled() && this.modalRef.data.animated !== false; protected dialogClass = this.modalRef.dialogClass ?? ''; protected titleId = this.modalRef.data?.ariaLabelledBy ?? ''; @@ -135,6 +137,6 @@ export class SiModalComponent implements OnInit, AfterViewInit, OnDestroy { } private animationTime(millis: number): number { - return this.modalRef?.data.animated !== false ? millis : 0; + return this.isAnimated ? millis : 0; } }