Best practice forum (Archived)

Selected class for custom menu items

 
Christoph Pirringer
Selected class for custom menu items
by Christoph Pirringer - Monday, 28 November 2016, 2:25 AM
 

I am not sure whether i am making a mistake from the config-side or whether this is a bug or missing feature of totara:


When i add custom menu items to the main menu and then go to those menu-items, the selected-class is not correctly set to either of them.


In this example, when i go to the first custom-item, no "selected"-class is added to any menu-item in that tab:


When i go to the second custom-item in the tab, the "selected"-class is added to the first menu-item of that tab instead of the one actually displayed.



Can anybody point me to a way to fix this behaviour and/or whether this is the intended functionality?


Thank you!

Brian Barnes (Core Developer)
Re: Selected class for custom menu items
by Brian Barnes (Core Developer) - Monday, 28 November 2016, 2:41 PM
Group Totara

Hi Christoph,

In this case, you are using URL's that already exist in the menu. If you look at your first screenshot, you will see that the "Calendar" menu option has been selected (as you are using that URL). In the second screenshot, the "courses" option has the selected CSS class (again as you are using that URL).

I suspect that if you use a URL that is not already in the menu, you sill see the item you select will have the "selected" CSS class.


Cheers,

Brian Barnes