Components: hasBackdrop: false prevents transparent overlay behind modal

Created on 1 Feb 2018  路  6Comments  路  Source: angular/components

Bug, feature request, or proposal:

When I set hasBackdrop: false, the overlay behind modal is not dark and transparent as expected

What is the expected behavior?

I expect the same behavior as hasBackdrop: true, the overlay behind modal is dark and transparent

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-4gl8gc

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

Angular 5, @angular/material & @angular/cdk: 5.1.1

Most helpful comment

Rather than setting hasBackdrop to false, I think what you'd like to do is use disableClose: true so that the user cannot close the modal via clicking on the backdrop.

All 6 comments

That is expected behavior. The 'transparent overlay' behind the modal is the backdrop. What is it that you're trying to accomplish by setting hasBackdrop: false?

Oh really? I did not it's the expected behavior. Is it possible to customize the back layer as normal backdrop if I still set hasBackdrop: false ? Or how to disable clicking outside to close modal without setting hasBackdrop: false ? I used ng-bootstrap before and even I set backdrop to false, I still had normal backdrop but disable clicking outside modal to close it. Therefore, I just want to know that if material has this feature. Thank you in advance.

Rather than setting hasBackdrop to false, I think what you'd like to do is use disableClose: true so that the user cannot close the modal via clicking on the backdrop.

Thank you so much, it works.

Rather than setting hasBackdrop to false, I think what you'd like to do is use disableClose: true so that the user cannot close the modal via clicking on the backdrop.

thanks ,this works for me "hasBackdrop:true"

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

constantinlucian picture constantinlucian  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

Miiekeee picture Miiekeee  路  3Comments

alanpurple picture alanpurple  路  3Comments

vanor89 picture vanor89  路  3Comments