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

Method _removeOpenDialog

src/cdk/dialog/dialog.ts:367–391  ·  view source on GitHub ↗

* Removes a dialog from the array of open dialogs. * @param dialogRef Dialog to be removed. * @param emitEvent Whether to emit an event if this is the last dialog.

(dialogRef: DialogRef<R, C>, emitEvent: boolean)

Source from the content-addressed store, hash-verified

365 * @param emitEvent Whether to emit an event if this is the last dialog.
366 */
367 private _removeOpenDialog<R, C>(dialogRef: DialogRef<R, C>, emitEvent: boolean) {
368 const index = this.openDialogs.indexOf(dialogRef);
369
370 if (index > -1) {
371 (this.openDialogs as DialogRef<R, C>[]).splice(index, 1);
372
373 // If all the dialogs were closed, remove/restore the `aria-hidden`
374 // to a the siblings and emit to the `afterAllClosed` stream.
375 if (!this.openDialogs.length) {
376 this._ariaHiddenElements.forEach((previousValue, element) => {
377 if (previousValue) {
378 element.setAttribute('aria-hidden', previousValue);
379 } else {
380 element.removeAttribute('aria-hidden');
381 }
382 });
383
384 this._ariaHiddenElements.clear();
385
386 if (emitEvent) {
387 this._getAfterAllClosed().next();
388 }
389 }
390 }
391 }
392
393 /** Hides all of the content that isn't an overlay from assistive technology. */
394 private _hideNonDialogContentFromAssistiveTechnology(overlayContainer: HTMLElement) {

Callers 2

openMethod · 0.95
ngOnDestroyMethod · 0.95

Calls 3

_getAfterAllClosedMethod · 0.95
clearMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected