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; } }