angular: [Animations] toggle state with `display: 'none'` doesn't work on Safari
š bug report
Affected Package
The issue is caused by package @angular/animationsIs this a regression?
Yes, the previous version in which this bug was not present was: 7.2.7Description
When using animation state with `display: 'none'` the animation does not fire/finish on Safari. It seems to be related to #28911 .š¬ Minimal Reproduction
https://stackblitz.com/edit/angular-v6-animations-txqyvd After click on āfadeā button, two texts should be shown (without actual āfade inā animation, they should just appear), what works perfectly fine in Chrome, Firefox and IE/Edge on Linux/Windows.
š Your Environment
Angular Version:
Angular: 7.2.8
Anything else relevant?
Safari on macOS and iPad
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 27
- Comments: 21 (1 by maintainers)
I have the same problem in IE11 in Angular 8.1.0: The animation seems to get stuck in a āanimation-play-state: running;ā state. Replacing ādisplay: none;ā with āheight: 0;ā seems to fix the problem.
@james-criscuolo, @dawda92 the diff is presence of
display: 'none'
in Stackblitz example and itās absence in Materialās exampleAngular 8 no longer support
display
property in animations. As I understood.Also, to get expanded row hided on default state, itās required to add
overflow: hidden
as in Materialās exampleThis works to me (take a note for an additional
void
state)@gizmodus @AmebaBrain I had the same issue with version 8.1.3 Animations containing
display:block <=> display:none
were not working on Safari Mac and iOS.Solved by display property and using
height:'*' <=> height:0
in animation states.I would never get back the 2 weeks that I spent solving this but thank you very much, everyone
Working code:
After trying several of the solution suggested here. Setting the height affected my transitions in a way that I didnāt want and
display: block
anddisplay: none
was required for my UI. I found that this one worked best for my case.Any update on this part? Iām facing the same problem.
I have this issue in Chrome/safari in ios 12.1.4 with Angular 8.1. It works on Safari if the experimental feature for web animation is turned on.
@simeyla The example was prepared very quickly from already existing stackblitz to show that nothing happens in the Safari. I know that it is actually only fading out and itās intended.
@Michsior14 Iām facing the same problem, where my animated container contains a
mat-progress-bar
so I donāt want to leave it animating the whole time my application is running!The problem is I donāt think your example really works very well on Chrome either.
I changed your stackblitz to use longer delays (of 2 or 4 seconds). When you click the āFadeā button to fade in you donāt actually see anything fading in - it just jumps to being visible after 2 seconds or 4 seconds.
So while there does indeed seem to be a regression in Safari - because it just flat doesnāt work - thereās a better way to do the
display: none
thing like this:The difference being the āblockā state is set on the transition. This works in Safari.
Stackblitz
However I canāt figure out why the animation of the mat-progress bar is completely messed up - but the panel animates just fine.
Still facing this issue at 7.2.14. 7.2.7 is the last version working, as stated above.