Expand only active trail if "auto-close" is enabled.

dmsmidt - July 31, 2008 - 11:17
Project:DHTML Menu
Version:7.x-1.x-dev
Component:User Interface
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

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

Arancaytar - August 28, 2008 - 13:52

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

Arancaytar - November 5, 2008 - 16:29
Version:6.x-3.0-beta» 6.x-3.x-dev
Status:active» needs review

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).

AttachmentSize
dhtml_menu_6_3_siblings_onload-289464-2.patch 1.86 KB

#3

Arancaytar - November 5, 2008 - 22:48
Version:6.x-3.x-dev» 7.x-1.x-dev
Status:needs review» patch (to be ported)

Committed to DRUPAL-6--3.

Will need porting to HEAD.

#4

Arancaytar - November 5, 2008 - 22:52
Status:patch (to be ported)» needs work

Oh dear. Forgot a bit of a conflict with #311248: Separating Menus.

#5

Arancaytar - November 6, 2008 - 04:42
Status:needs work» patch (to be ported)

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

Arancaytar - November 9, 2008 - 23:00
Status:patch (to be ported)» postponed

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

Arancaytar - June 1, 2009 - 16:18
Title:Auto expand/collapse subitems on viewing page» Expand only active trail if "auto-close" is enabled.
Category:bug report» task
Status:postponed» active

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.

 
 

Drupal is a registered trademark of Dries Buytaert.