MCPcopy Create free account
hub / github.com/angular/components / close

Method close

src/material/select/select.ts:757–770  ·  view source on GitHub ↗

Closes the overlay panel and focuses the host element.

()

Source from the content-addressed store, hash-verified

755
756 /** Closes the overlay panel and focuses the host element. */
757 close(): void {
758 if (this._panelOpen) {
759 this._panelOpen = false;
760 this._exitAndDetach();
761 this._keyManager.withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr');
762 this._changeDetectorRef.markForCheck();
763 this._onTouched();
764 // Required for the MDC form field to pick up when the overlay has been closed.
765 this.stateChanges.next();
766
767 // Simulate the animation event before we moved away from `@angular/animations`.
768 Promise.resolve().then(() => this.openedChange.emit(false));
769 }
770 }
771
772 /** Triggers the exit animation and detaches the overlay at the end. */
773 private _exitAndDetach() {

Callers 8

toggleMethod · 0.95
_handleOpenKeydownMethod · 0.95
_handleOverlayKeydownMethod · 0.95
_initKeyManagerMethod · 0.95
_resetOptionsMethod · 0.95
constructorMethod · 0.45
dismissMethod · 0.45
select.spec.tsFile · 0.45

Calls 7

_exitAndDetachMethod · 0.95
_isRtlMethod · 0.95
markForCheckMethod · 0.80
_onTouchedMethod · 0.80
resolveMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected