Skip to content

Commit

Permalink
fix(material/sidenav): remove IE animation workaround (#29929)
Browse files Browse the repository at this point in the history
Removes a workaround that's no longer necessary now that we don't support IE.

(cherry picked from commit 070be9f)
  • Loading branch information
crisbeto committed Oct 28, 2024
1 parent a621a79 commit d28e99c
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions src/material/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,7 @@ import {
ViewEncapsulation,
} from '@angular/core';
import {fromEvent, merge, Observable, Subject} from 'rxjs';
import {
debounceTime,
distinctUntilChanged,
filter,
map,
mapTo,
startWith,
take,
takeUntil,
} from 'rxjs/operators';
import {debounceTime, filter, map, mapTo, startWith, take, takeUntil} from 'rxjs/operators';
import {matDrawerAnimations} from './drawer-animations';

/**
Expand Down Expand Up @@ -367,24 +358,16 @@ export class MatDrawer implements AfterViewInit, AfterContentChecked, OnDestroy
);
});

// We need a Subject with distinctUntilChanged, because the `done` event
// fires twice on some browsers. See https://github.com/angular/angular/issues/24084
this._animationEnd
.pipe(
distinctUntilChanged((x, y) => {
return x.fromState === y.fromState && x.toState === y.toState;
}),
)
.subscribe((event: AnimationEvent) => {
const {fromState, toState} = event;
this._animationEnd.subscribe((event: AnimationEvent) => {
const {fromState, toState} = event;

if (
(toState.indexOf('open') === 0 && fromState === 'void') ||
(toState === 'void' && fromState.indexOf('open') === 0)
) {
this.openedChange.emit(this._opened);
}
});
if (
(toState.indexOf('open') === 0 && fromState === 'void') ||
(toState === 'void' && fromState.indexOf('open') === 0)
) {
this.openedChange.emit(this._opened);
}
});
}

/**
Expand Down

0 comments on commit d28e99c

Please sign in to comment.