Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
elvisbegovic opened this issue Sep 9, 2016 · 12 comments
Closed

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

elvisbegovic opened this issue Sep 9, 2016 · 12 comments
Assignees
Labels
needs: discussion Further discussion with the team is needed before proceeding

Comments

@elvisbegovic
Copy link

elvisbegovic commented Sep 9, 2016

Proposal:

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

@todrules
Copy link

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
Copy link
Author

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
Copy link
Author

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

@mmalerba
Copy link
Contributor

@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
Copy link
Member

@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
Copy link
Contributor

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
Copy link
Member

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
Copy link
Contributor

#1427 is requesting a callback

@christophechevalier
Copy link

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

@mmalerba
Copy link
Contributor

@christophechevalier see #1899

@mmalerba
Copy link
Contributor

mmalerba commented May 5, 2017

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

@mmalerba mmalerba closed this as completed May 5, 2017
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
@mmalerba mmalerba added the needs: discussion Further discussion with the team is needed before proceeding label Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: discussion Further discussion with the team is needed before proceeding
Projects
None yet
Development

No branches or pull requests

5 participants