disableClose property, when set to false, should allow the user to click outside of the modal to close it whenever the hasBackdrop property is also set to false.disableClose and hasBackdrop properties are set to false, the user should still be able to click outside of the modal to close it.I'm not sure, but I think in this case, the backdrop is used to detect a click on the outside of the dialog. So, if you disable the backdrop, you cannot expect it to close with outside clicks. It works with ESC though.
@julianobrasil => I just realized that it does, in fact, work with the ESC key, but clicking out does not and it is stated in the documentation that it should. I will update my issue notes now.
I am okay with the fact that these two properties might not work together (probably because they are binding the click even to the backdrop / overlay), but then the documentation should be updated to reflect that functionality.
The backdrop is used to handle the clicks outside the dialog. When you set hasBackdrop to false, the element won't be rendered at all. If you don't want the darkened backdrop, but still want clicking outside to work, you can set the backdropClass to cdk-overlay-transparent-backdrop.
@crisbeto => I tried your suggestion in the provided Stackblitz and it still doesn't fix the issue of clicking outside the dialog. Do you have any other suggestions?
It seems to work here: https://stackblitz.com/edit/angular-macdjt-cfkdpg
@crisbeto => .............I...am not sure what the heck I did wrong there.
Thank you for the provided workaround, but I do still believe that this should be done automatically by the library, rather than having to remember to do this by setting another property. What do you think @crisbeto?
I'd say that the config options are explicit enough. I don't think that we can handle this automatically without making some assumptions which could break existing usages.
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._
Most helpful comment
The backdrop is used to handle the clicks outside the dialog. When you set
hasBackdropto false, the element won't be rendered at all. If you don't want the darkened backdrop, but still want clicking outside to work, you can set thebackdropClasstocdk-overlay-transparent-backdrop.