I’m currently implementing a sidemenu using a sideMenuToggleButton. What I’ve realized is that, after a menuitem click the stylename “c-sidemenu-open” (HaloTheme.SIDEMENU_PANEL_OPEN) is removed and therefore the sidebar is closed.
The relevant classes are WebSideMenu and CubaSideMenu:
I would like to keep the sidemenu opened after menuitem click. How can I keep the stylename “c-sidemenu-open”? Or what is the intention of the sidemenu toggle button?
SideMenu with responsive styles is intended to correctly show menu in small screen devices. The default behavior is closing side panel when we click on a menu item because in small screen devices this panel takes a lot of space. Such behavior is the same as in Android and Polymer.
If you don’t want to close panel by click on menu item, you can extend WebSideMenu component:
public class SideMenuExt extends WebSideMenu {
public SideMenuExt() {
// set null or specific logic
component.setBeforeMenuItemTriggeredHandler(null);
}
}
In order to use your extended component in all application you need to create ui-component.xml in the root package in web module: