MatDialog - hasBackdrop/disableClose conflict with each other
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
MatDialogConfig disableClose
should function like the documentation states:
disableClose: boolean | Whether the user can use escape or clicking outside to close a modal.
What is the current behavior?
When configuration the MatDialogConfig to include hasBackdrop: false
, you lose the ability to close the modal when a user clicks outside of it. This is to also say that mentioning disableClose
in the config does nothing if hasBackdrop
is false
What are the steps to reproduce?
Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://goo.gl/wwnhMV
https://stackblitz.com/edit/angular-ev6jqa?file=app/dialog-overview-example.ts
What is the use-case or motivation for changing an existing behavior?
Quality
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 5 and 6
Is there anything else we should know?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
angular 2: prevent user to click outside the modal dialog
I think you need to do something like this: this.dialogRef = this.dialog.open(DialogResultComponent, { disableClose ...
Read more >How To Prevent MatDialog From Closing When Clicked Outside
In this blog, you will learn how to prevent MatDialog from closing ... a built-in property called disableClose the prevents this behavior.
Read more >@angular/material | Yarn - Package Manager
The Angular team builds and maintains both common UI components and tools to help you build your own custom components. The team maintains...
Read more >UNPKG - @angular/material
n *\n * This module should be imported to each top-level component module (e.g., MatTabsModule) ... n * Null dates are considered equal...
Read more >demo/node_modules/@angular/material/@angular ... - GitLab
n * Captures the header row's template and other header properties such as the columns ... Property with mat- prefix for no-conflict mode....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The workaround is to not use
disableBackgrop
ordisableClose
but usebackdropClass
instead: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.