-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.5.4
-
None
-
MOODLE_405_STABLE
When having sub-menus inside the primary navigation, and the viewport is narrow enough to show the navigation inside the left drawer, clicking on one sub-menu toggles multiple sub-menus simultaniously.
We extend the primary navigation using hooks, similar to this (sorry, the formatting is somehow borked):
function extend_navigation(\core\hook\navigation\primary_extend $hook): void { |
$nav = $hook->get_primaryview(); $submenua = $nav->add('Submenu A', null, navigation_node::TYPE_CONTAINER, null, 'suba'); |
$submenua->add('abc', 'https://example.org'); $submenub = $nav->add('Submenu B', null, navigation_node::TYPE_CONTAINER, null, 'subb'); |
$submenub->add('xyz', 'https://example.org'); |
}
|
I looked into the rendered HTML, where each sub-menu node has id="drop-down-"; essentially, they all have the same ID, which the responsible JS most likely needs to decide which menu to toggle.
It looks like there is something missing from the ID. Checking out theme/boost/templates/primary-drawer-mobile.mustache I find this: id="drop-down-{{sort}}"
Interestingly, sub-menus created by using the custommenu setting are not affected by this bug, for example:
Some Menu
|
-example a|https://example.org
|
Some Other Menu
|
-example b|https://example.org
|
These menus do have their IDs set properly, though.
- has been marked as being related by
-
MDL-85273 Dropdown "custom menu item" will not toggle when in "More" menu in Primary navigation
-
- Closed
-