-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Reshrink Sidebar after selection #23
Comments
Hey @blankstar85, thanks for your comment. Not sure exactly what you mean though :) Would you mind to elaborate on this? |
I think he means that the sidebar should collapse automatically if the sidebar was collapsed before a menuitem was clicked. |
Right, okay. Thanks for the idea, we will consider it on later stages. |
Hello Nnixaa, yes Gentle9 explained this much better. I'll try better in the future. Thanks! Love the theme by the way! |
@blankstar85 glad to hear you like it! |
Trying out the theme, like it a lot so far. On the topic, I was trying to do what the OP suggested manually but it's not working and I'd like to know why.
|
running into the same problem as @blankstar85 , currently if the user toggles the sidebar to be a compacted view, any click on a menu item will result in the sidebar to be expanded back out. Unfortunately it also seems that because this is manipulated internally, there are no events that are emitted out so that as developers we can react to this. Would it be a possible solution to either emit out this event (so that devs can then choose to react and take action if they wish), or better yet, simply don't set the state of the sidebar to be expanded?
onClick(event): void {
const menu = this.element.nativeElement.querySelector('nb-menu');
if (menu && menu.contains(event.target)) {
this.expand(); // << this line here
}
} |
This is not just limited to menu click, when you set menu to responsive, it also compact when window becomes smaller and expand when window expanded, that too doesn't emit any event. Unable to handle menu size change event due to that. |
Hi Guys, could anyone please sum up the proposed changes? |
Hi @nnixaa i believe the simplest resolution would be to remove the call to Test:
Expected Result:
|
Right, but then there is no way you can access the children menu items, meaning that if the menu item has children elements and you click on it - nothing will happen, resolving into a quite weird behavior, don't you think so? |
Potentially yes. Perhaps a compromise could be reached, taking the Akveo/Blue Admin template as an example, the following occurs:
Perhaps following a similar mantra will address both issues, and at the very least, provide consistency to users of these templates :) |
Hello @nnixaa ,
My Menu has 1-level only MenuItems. In mobile, user taps on Hamburguer Menu, the Menu expands automatically and fills 3/4 screen width, but when user taps again on one ItemMenu I expect Menu hides automatically for usability reasons. Is there any parameter for this feature? |
Hi, when I select a item on menu, the other items expanded doesn't should collapsed? thanks |
Hi! I don't think this was really solved. The concern lays on collapsing the sidebar when an item is selected, assuming the selection navigates away and the sidebar will cover part of the content.
This goes on my |
@nnixaa I have the same problem, BUT I fix with this: On Router Items (Components)
on click the component is called and the ngOnInit( ) call the toggle( ) method |
Not sure why menu auto close for mobile is working perfectly in their demo: https://www.akveo.com/ngx-admin/pages/iot-dashboard |
Thanks @mspivak for sharing your solution, I implemented the same in mine and below are my findings:
|
Thanks everyone. Based on your solutions I created another solution which accounts for different screen sizes.
|
If the user shrinks the sidebar using nb-menu button toggle in the upper left corner, the sidebar should reshrink after selecting an option.
The text was updated successfully, but these errors were encountered: