components icon indicating copy to clipboard operation
components copied to clipboard

sidenav (over mode) disable backdrop click to close

Open elvisbegovic opened this issue 10 years ago • 12 comments

Proposal:

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

elvisbegovic avatar Sep 09 '16 13:09 elvisbegovic

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.

todrules avatar Sep 10 '16 04:09 todrules

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 avatar Sep 11 '16 10:09 elvisbegovic

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

elvisbegovic avatar Sep 16 '16 19:09 elvisbegovic

@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

mmalerba avatar Nov 11 '16 18:11 mmalerba

@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.

jelbourn avatar Nov 16 '16 02:11 jelbourn

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

mmalerba avatar Nov 16 '16 18:11 mmalerba

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.

jelbourn avatar Nov 16 '16 18:11 jelbourn

#1427 is requesting a callback

mmalerba avatar Nov 16 '16 21:11 mmalerba

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

  • clicking on the backdrop
  • doing it programmatically : this.mySidenav.close()

image

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

Thanks

christophechevalier avatar Nov 25 '16 14:11 christophechevalier

@christophechevalier see #1899

mmalerba avatar Nov 28 '16 16:11 mmalerba

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

mmalerba avatar May 05 '17 20:05 mmalerba

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.