0

We are using mat-select on a mat-dialog popup. If we open the mat-select to select options and then press Esc, it closes the popup instead of mat-select options dropdown.

We are on version 12.1.4 for Angular / Cdk / Material.

Thanks in advance.

Jackdaw
  • 7,626
  • 5
  • 15
  • 33
Dnyaneshwar
  • 148
  • 7
  • 1
    Seems to be working fine here: https://stackblitz.com/edit/angular-54r4vt?file=src%2Fapp%2Fdialog-overview-example.ts Please provide a [mcve] – AT82 Nov 29 '21 at 10:56

1 Answers1

1

this is duplicated Question, you can find old question from this link,

also for answering this you can use disableClose when try to open the MatDialogConfig. however, you need to add code for enabling closing when click on the backdrop to close the dialog.

    let dialogRef = this.dialog.open(EditPlaceDialogComponent, { disableClose: true /* Your other config options here */ });
  /*
     Subscribe to events emitted when the backdrop is clicked
     NOTE: Since we won't actually be using the `MouseEvent` event, we'll just use an underscore here
     See https://stackoverflow.com/a/41086381 for more info
  */
  dialogRef.backdropClick().subscribe(_ => {
    // Close the dialog
    dialogRef.close();
  })