Expand only active trail if "auto-close" is enabled.
| Project: | DHTML Menu |
| Version: | 7.x-1.x-dev |
| Component: | User Interface |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
The title may be a bit confusing but I'll try to explain. First of all I love the progress DHTML menu has made so far and the 3.x branch is just fabulous.
However, in my website I have two ways of navigating to a page. A dropdown menu and a DHTML powered menu. If I navigate through my dropdown to a page which is a child of another menu, the DHTML menu automatically expands the active item ( active class, tail etc..), it's just great! But when I already had a menu item expanded, that previous menu still is open, which is odd because in my config I ticked the option: keep only one menu open at a time.. Furthermore in Firefox (IE just fine) when I close this other menu manually and open another page, it just opens expanded again.. while I just closed it manually on the previous page. Some cookie save state issue?
It's not a heartbraker but DHTML menu just doesn't work as expected in every case.

#1
Thanks for reporting this. I will see if I can apply the "only one menu open" logic at startup so that only the current path starts out as open.
The state-saving problem is new to me. I'll try to duplicate that.
#2
The first problem has been fixed in this patch.
I have not been able to reproduce the second problem. If I open "Create Content" in the menu, then enter "/admin" in the URL bar, both menus will be open - but if I close "Create Content", then navigate to "/user/1", "Create Content" remains closed (and "Administration" will be closed as well).
#3
Committed to DRUPAL-6--3.
Will need porting to HEAD.
#4
Oh dear. Forgot a bit of a conflict with #311248: Separating Menus.
#5
Well, so be it. It looks damn near impossible to resolve that.
Edit: Specifically, I was able to add some convoluted server-side logic that tried to set a menu as collapsed if it was in the same root as the active trail. But since my module only knows the active trail once it processes the corresponding menu item, menus that precede the active trail will not be affected.
Example: Expand admin, visit node/all: admin is collapsed and node/add is expanded, as you wanted. Expand node/add, enter URL
/admin, both are expanded: node/add is already processed by the time dhtml_menu finds the active trail in admin.Rather than having the module do surprising things in this particular case, I'll stick with what's being done now.
#6
The 6.x-3.x method of doing it is ugly, and I would like to do it more elegantly in D7.
Experience has shown that letting these things simmer for a while will eventually lead to a neat solution. (The new theme layer approach of 3.0 came to me after a month of frustration.) So I'll put this on the backburner.
#7
Thinking on it half a year later, I believe this is the best solution after all. If only one menu should be open at a time, then the cookie and the "always expanded" will simply be ignored. With the settings and the cookie being more elegantly handled in D7, doing it this way isn't ugly at all.