@@ -176,14 +176,13 @@ export class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy
176176 if ( ! this . _destroyed ) {
177177 this . _screenReaderAnnounce ( ) ;
178178
179- if ( this . _animationsDisabled ) {
180- this . _completeEnter ( ) ;
181- } else {
182- // Guarantees that the animation-related events will
183- // fire even if something interrupts the animation.
184- clearTimeout ( this . _enterFallback ) ;
185- this . _enterFallback = setTimeout ( this . _completeEnter , 200 ) ;
186- }
179+ // Guarantees that the animation-related events will
180+ // fire even if something interrupts the animation.
181+ clearTimeout ( this . _enterFallback ) ;
182+ this . _enterFallback = setTimeout (
183+ this . _completeEnter ,
184+ this . _animationsDisabled ? undefined : 200 ,
185+ ) ;
187186 }
188187 }
189188
@@ -198,16 +197,10 @@ export class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy
198197 // long enough to visually read it either, so clear the timeout for announcing.
199198 clearTimeout ( this . _announceTimeoutId ) ;
200199
201- if ( this . _animationsDisabled ) {
202- // It's common for snack bars to be opened by random outside calls like HTTP requests or
203- // errors. Run inside the NgZone to ensure that it functions correctly.
204- this . _ngZone . run ( this . _completeExit ) ;
205- } else {
206- // Guarantees that the animation-related events will
207- // fire even if something interrupts the animation.
208- clearTimeout ( this . _exitFallback ) ;
209- this . _exitFallback = setTimeout ( this . _completeExit , 150 ) ;
210- }
200+ // Guarantees that the animation-related events will
201+ // fire even if something interrupts the animation.
202+ clearTimeout ( this . _exitFallback ) ;
203+ this . _exitFallback = setTimeout ( this . _completeExit , this . _animationsDisabled ? undefined : 150 ) ;
211204
212205 return this . _onExit ;
213206 }
0 commit comments