Components: Backdrop stays open after navigate using routerlink from inside mat dialog

Created on 20 Feb 2019  路  6Comments  路  Source: angular/components

What is the expected behavior?

When clicking an element with the routerLink directive, the navigation should close the dialog and make the backdrop disappear

What is the current behavior?

The dialog closes but the backdrop stays open.
Doesn't work even with closeOnNavigation: true or with applying mat-dialog-close to the element that has the routerLink directive

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

Have an element with a routerLink directive inside a mat dialog template and click on it to navigate.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular Core: 7.2.5
Angular Material: 7.3.2

Is there anything else we should know?

Most helpful comment

Any news on this?

My current workaround:

private _dialogRef: MatDialogRef<ModalComponent> = null;

openDialog() {
    this._dialogRef = this._dialog.open(ModalComponent);
    this._dialogRef.afterClosed().subscribe(() => this._dialogRef = null);
}

ngOnDestroy() {
    if (this._dialogRef) {
        this._dialogRef.close();
    }
}

All 6 comments

Can you provide a reproduction in StackBlitz. This will help us to investigate the issue you are seeing.

Any news on this?

My current workaround:

private _dialogRef: MatDialogRef<ModalComponent> = null;

openDialog() {
    this._dialogRef = this._dialog.open(ModalComponent);
    this._dialogRef.afterClosed().subscribe(() => this._dialogRef = null);
}

ngOnDestroy() {
    if (this._dialogRef) {
        this._dialogRef.close();
    }
}

Closing because this issue has been inactive for 2 weeks or more after follow up was requested.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MurhafSousli picture MurhafSousli  路  3Comments

constantinlucian picture constantinlucian  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

vitaly-t picture vitaly-t  路  3Comments

LoganDupont picture LoganDupont  路  3Comments