How to collapse menu after click on menuitem when in hamburger mode

If I use a menu with navigation in non hamburger mode, the menu will collapse after clicking on the menuitem and navigating to the new page.

However with HamburgerMode=true the menu does not collapse automatically and the hamburger must be again clicked to collapse it out of the way.

I cant think of a reason why the menu in hamburger mode should not automatically collapse after navigation.

Is there additional code required or is this a bug ? 



4 Replies

JS Janakiraman Sakthivel Syncfusion Team February 21, 2022 02:18 PM UTC

Hi Orange, 
  
We are able to achieve your requirement by using the ItemSelected event and the CloseAsync() function as shown below. 
 
[Index.razor] 
<MenuEvents ItemSelected="itemSelected" TValue="MenuItem"></MenuEvents> 
 
@code{ 
public void itemSelected() 
{ 
    MenuObj.CloseAsync(); 
} 
} 
 
For your convenience we have prepared the sample and video demonstration for this. Please find the link below. 
 
 
 
Could you please check the above links and get back to us, if you need any further assistance on this. 
 
Regards, 
Janakiraman S. 



OR Orange February 24, 2022 12:58 PM UTC

Thankyou that does the job.

I still find it odd that this behaviour is not the default, I cant think of a scenario where keeping the menu open is necessary.





JS Janakiraman Sakthivel Syncfusion Team February 28, 2022 05:49 PM UTC

Hi Orange, 
 
We need to validate more on your reported requirement, so we will update you the further details on March 2nd, 2022. 
 
Regards, 
Janakiraman S.  



SP Sangeetha Priya Murugan Syncfusion Team March 10, 2022 11:45 AM UTC

Hi Orange, 
 
We have provided Open/Close public methods to customize the open and close options of hamburger menu. However, these methods were not available for normal mode menu. So, only we have suggested the same in our previous update to achieve your requirement. 
 
Could you please check the above details and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 


Loader.
Up arrow icon