Skip to content

refactor(modal): allow to disable dialog animation#1478

Open
spliffone wants to merge 1 commit intomainfrom
refactor/modal-allow-disabling-animations
Open

refactor(modal): allow to disable dialog animation#1478
spliffone wants to merge 1 commit intomainfrom
refactor/modal-allow-disabling-animations

Conversation

@spliffone
Copy link
Member

@spliffone spliffone commented Feb 9, 2026

Describe in detail what your merge request does and why. Add relevant
screenshots and reference related issues via Closes #XY or Related to #XY.


@spliffone spliffone requested a review from a team as a code owner February 9, 2026 14:12
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a global flag to disable modal animations, which is a good improvement for accessibility and performance on low-end devices. The implementation correctly uses a helper to check for the global setting.

However, the current implementation is incomplete. The global animation setting is only applied to the animation timings controlled by animationTime(), but not to the CSS-based fade animations or the backdrop animation logic.

I've added a couple of suggestions to refactor the logic into a reusable isAnimated property. Adopting this suggestion and using the new property consistently in showBackdrop() and the component's template (si-modal.component.html) will fix the issue and make the code cleaner.

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

@spliffone spliffone force-pushed the refactor/modal-allow-disabling-animations branch from 466bd67 to e3fa53f Compare February 9, 2026 14:40

private animationTime(millis: number): number {
return this.modalRef?.data.animated !== false ? millis : 0;
return this.isAnimated ? millis : 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need still need to respect data.animated.

@dr-itz do you think we can deprecate the animated property with this change? Was there a specific use case why this was introduced?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is respected in line 31

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I don't really remember, but I guess this was for ngx-bootstrap compatibility. So yeah, having this here feels kinda pointless

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Code Coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants