We have 2 menus. In each of them we have a menu-item linking to a node (page) called 'contact' (see screenshot).
The item in the horizontal menu was created first (called 'item1' in following text), the item in the vertical menu was created afterwards (called 'item2' in following text).
Result of this sequence is that item1 has a lower mid in the database than item2. For example: item1 has mid 99, item2 has mid 100.
Item1 does not have children, item2 does have children.
Now, if the 'contact' page is active (where both item1 and item2 link to), we would expect that:
- the list-item for item1 has the class 'leaf' and an <a>-tag inside with the class 'active' assigned.
- the list-item for item2 has the class 'expanded' and an <a>-tag inside with the class 'active' assigned.
What is happening instead:
- the list-item for item1 has the class 'leaf' and an <a>-tag inside with the class 'active' assigned (expected behaviour).
- the list-item for item2 has the class 'collapsed' and an <a>-tag inside with the class 'active' assigned (unexpected behaviour).
What we think goes wrong:
At the moment the menu-system searches for the mid of item2, but it collects the mid for item1. This happens because drupal uses the current url to search the mid.
Both item1 and item2 have the same path (as result that they link to the same node). Item1 has a lower mid than item2, so item1 is found first (with the given path),
and thus the mid of item1 (99) will be returned instead of the mid of item2 (100).
Then it checks wether or not the mid has children. Because the mid for item1 was collected, no children will be found and the list-item will get the class 'collapsed' assigned
(the '$leaf' variable for item2 had been assigned at an earlier stage in the code to 'false' as expected).
What we did to 'solve' the problem temporary in our specific situation:
- delete item1 (mid 99 deleted)
- add item1 again (it gets mid 101 for example)
This action will have the result that the mid for item1 (101) will be higher than the mid of item2 (100).
So at the moment the menu-system searches for the mid of item2 it will get the correct mid (because now the first found mid with the given path will be the mid of item2).
At this point the list-item will get the correct class 'expanded' (as expected) and thus the children of item2 will be rendered to.