-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-sidenav: add possibility to programmatically close sidebar even with md-is-locked-open attribute #3027
Comments
+1 |
+1 The requested behavior (ability to close an The current implementation only allows using the http://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-behavior
Providing the possibility to toggle an |
+1 |
+1 |
Couldn't you just use the Here's a quick-and-dirty example that relies on parent scopes, but there are a number of ways you could do it: http://codepen.io/mzbyszynski/pen/aOEQJX Click the "Unlock Sidenav Left" button to unlock the sidenav. Or am I misunderstanding what you are asking for? |
@mzbyszynski yep, that's definitely a simple solution. Ashamed of not being able to come up to such obvious answer to the problem (( thanks. Closing. |
While I see how @mzbyszynski's method somewhat fixes the problem (I'm already using a similar approach but totally forgot about this issue sorry!), I rather see it as hackfix than final solution. Nonetheless, thank you for the snippet and for taking a look at the problem @mzbyszynski! The problem I see is that it still needs two different methods for toggling the sidenav depending on whether it is persistent or not. If it is persistent one needs to toggle In my humble opinion it would be great to have a common way of interacting with the My personal approach for a hybrid sidenav (persistent on large devices, non-persistent on small ones) as in @mzbyszynski's snippet is the following (see http://codepen.io/anon/pen/XbVyww for the actual implementation) :
In my opinion, this is a very intuitive way of configuring such a hybrid sidenav and also somewhat works as expected. Unfortunately when toggling both properties to false ( So, I still see the need for some fixing. What do you think? |
@freitag-solutions What is your CSS 'hack' to remove the backdrop? |
@mzbyszynski it seems that the codepen example does not work as nicely with the latest master branch. I get an md-backdrop flash on close, and no animation. I'd love to see something like $mdSidenav('left').toggleLocked(); If it helps , my use case is a data table that takes up as much of the real estate as possible. Then optionally, a filter sidebar can be opened to drill down (like Amazon's refine by). |
@andrea-vega I think the issues you are seeing might be related to #4152. When I use angular material 0.10.1 with angular 1.3 the animations seem to work ok, but when I change to 1.4.4 then I don't see the animation anymore. I didn't notice the backdrop flashing but it might be. Angular 1.3.15 + Angular Material 0.10.0: Angular 1.3.15 + Angular Material 0.10.1: Angular 1.4.4 + Angular material 0.10.1: |
@pdore-netfore Here's the css I used to remove the backdrop (except on mobile):
|
@mzbyszynski — I read somewhere around here that it is fixed with 1.4.5. and also, that $mdSidenav is about to be refactored soon, |
@sm+1 The proposed solution is a hack and is inconsistent with |
I achieved this the following way:
And then in JS:
|
@MikaelLandau But what about the sliding animation? |
@PsyGik - I think all happens through CSS classes dynamically injected/removed according to the SIdebar's state. But I could be wrong. |
Edit: Nevermind my comment, it is actually working.. |
In order to remove the flash of the backdrop. I used a variable for each attribute.
This also allows you to control if the sidenav is open once the screen size is changed. I personally expect the sidenav to disappear and not to become an overlay if the screen size hits the lower size.
Tested with v1.0.5. |
thx @roy46 work well... I just had to initialize the
|
I think, that behaviour should be the following:
The text was updated successfully, but these errors were encountered: