* 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)
| 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) { |
no test coverage detected