I have a mat menu inside mat dialog. After opening dialog and then menu inside it, i pressed esc to close the menu, but both menu and dialog are closed. How to close just the menu and not the dialog with ESC?
It can be reproduced here. https://stackblitz.com/edit/angular-wzau6u
You can add
disableClose: true
to thedialogRef
configuration, to prevent the dialog closing from pressing esc. It's explained in the API of the Dialog component.See this updated StackBlitz for reference.