angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.72k forks source link

sidenav (over mode) disable backdrop click to close #1213

Closed elvisbegovic closed 7 years ago

elvisbegovic commented 8 years ago

Proposal:

Actually when we use sidenav in over mode, we can't disable closing sidenav when clicking on backdrop, any enhancement in mind ?

todrules commented 8 years ago

You could use 'pointer-events: none' on the sidenav layout. Just make sure you add 'pointer-events: initial' to any child objects that you want to click on.

elvisbegovic commented 8 years ago

thanks this workaround will help me , many thanks!!! it will be nice if there is option to disable closing sidenav when clicking on backdrop thanks

elvisbegovic commented 7 years ago

https://files.gitter.im/angular/material2/pmEd/sidenav-error.gif Strange error

mmalerba commented 7 years ago

@jelbourn how about if we add something like this?

@Input('backdrop-action')
backdropAction: 'close' | 'none' | () => boolean = 'close';

that way its easy to close or do nothing, but you can still do custom stuff if you like

jelbourn commented 7 years ago

@mmalerba we could make it align with the overlay and dialog. Overlay exposes a backdropClick observable that lets you do whatever you want, and dialog has a disableClose option that prevents the dialog from closing itself based on backdrop click or escape key.

mmalerba commented 7 years ago

That seems a little more awkward since you have to set two properties, one to stop the default action and one to supply your own. can we make the overlay work like my proposal instead? :p

jelbourn commented 7 years ago

The overlay just exposes the observable to let the component do whatever it wants. The dialog doesn't expose the observable and just has disableClose. For the sidenav I'd think that disableClose would make sense since I'm not sure what else you'd do with a backdrop clip.

mmalerba commented 7 years ago

1427 is requesting a callback

christophechevalier commented 7 years ago

I have a similar error (same to @istiti) when I close the sidenav either by :

image

Am I the only one (is there something wrong with my code) ? Or is it something known ?

Thanks

mmalerba commented 7 years ago

@christophechevalier see #1899

mmalerba commented 7 years ago

This has been implemented via the disableClose property on <md-sidenav>

angular-automatic-lock-bot[bot] commented 5 years ago

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.