Triggers the exit animation and detaches the overlay at the end.
()
| 769 | |
| 770 | /** Triggers the exit animation and detaches the overlay at the end. */ |
| 771 | private _exitAndDetach() { |
| 772 | if (this._animationsDisabled || !this.panel) { |
| 773 | this._detachOverlay(); |
| 774 | return; |
| 775 | } |
| 776 | |
| 777 | this._cleanupDetach?.(); |
| 778 | this._cleanupDetach = () => { |
| 779 | cleanupEvent(); |
| 780 | clearTimeout(exitFallbackTimer); |
| 781 | this._cleanupDetach = undefined; |
| 782 | }; |
| 783 | |
| 784 | const panel: HTMLElement = this.panel.nativeElement; |
| 785 | const cleanupEvent = this._renderer.listen(panel, 'animationend', (event: AnimationEvent) => { |
| 786 | if (event.animationName === '_mat-select-exit') { |
| 787 | this._cleanupDetach?.(); |
| 788 | this._detachOverlay(); |
| 789 | } |
| 790 | }); |
| 791 | |
| 792 | // Since closing the overlay depends on the animation, we have a fallback in case the panel |
| 793 | // doesn't animate. This can happen in some internal tests that do `* {animation: none}`. |
| 794 | const exitFallbackTimer = setTimeout(() => { |
| 795 | this._cleanupDetach?.(); |
| 796 | this._detachOverlay(); |
| 797 | }, 200); |
| 798 | |
| 799 | panel.classList.add('mat-select-panel-exit'); |
| 800 | } |
| 801 | |
| 802 | /** Detaches the current overlay directive. */ |
| 803 | private _detachOverlay() { |
no test coverage detected