Components: sidenav (over mode) disable backdrop click to close

Created on 9 Sep 2016  路  12Comments  路  Source: angular/components

Proposal:

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

needs discussion

Most helpful comment

@christophechevalier see #1899

All 12 comments

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.

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

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

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

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.

1427 is requesting a callback

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 see #1899

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

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