Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The FIRST click you do on a page to an item that is collapsable. (only the first)
The class the tuns into:" dhtml-menu collapsed start-collapsed dhtml-folder expanded"
The collapse does not get removed. Bug.
Comment | File | Size | Author |
---|---|---|---|
#22 | 1178234-22.patch | 923 bytes | vuil |
Comments
Comment #1
marcoka CreditAttribution: marcoka commentedattached patches should fix that.
http://drupal.org/node/1178226 This patch is already in the attached patches
General problem was the following:
Somehow core or taxonomy menu adds its own class "collapsed" "expanded" to menu items, so this results in double classes because dhtml menu classes are called collapsed and expanded too. i renamed them to be "collapsed-dhtml" and "expanded-dhtml"
My tests were successfull and it worked for me.
Please test.
Comment #2
vthirteen CreditAttribution: vthirteen commentedagainst which files should these patches be applied?
[EDIT]
collapsed_expanded_PHP.patch against dhtml_menu.theme.inc
collapsed_expanded_JS.patch against dhtml_menu.js
is that right?
Comment #3
marcoka CreditAttribution: marcoka commentedhm crap netbeans did not add the files.....boah.
yes that is right i think.
Comment #4
vthirteen CreditAttribution: vthirteen commentedOK, but now links just do not expand while in static navigation option 1 "No collapsing" is checked...
Comment #5
vthirteen CreditAttribution: vthirteen commentedwithout the above patches, the DHTML menu expand as expected but it closes up again when the new page is loaded. not friendly.
after patching code, whatever option is set under "Other effects" the menus always stays collapsed and only first level parents are shown and clickable. not usable.
Comment #6
Peasoup CreditAttribution: Peasoup commentedPatches did not work for me :/ No change at all.
Comment #7
michaelfavia CreditAttribution: michaelfavia commentedHere is the patch from above in a more standard unified git format. it seems to be functional but changes the css class to add dhtml.
Comment #8
felixSchl CreditAttribution: felixSchl commentedThe patches work for me, however there remains a problem. In the following case, the classes are not set correctly:
-Set Dhtml Module to remember opened menus
-Open a submenu item in a Dhtml menu
-Close the menu while still viewing the page
-Refresh
You will see the menu is set back to being expanded (which i think is cool), however, it is missing the dhtml-menu classes, hence we get the normal drupal arrow icon. It worked before the patch because dhtml menu would also use the expanded classes.
I think there might be away around it with using the active trail classes and such, but I though I just point it out here.
Cheers
Comment #9
felixSchl CreditAttribution: felixSchl commentedIs anyone else experiencing the following issue: When clicking on a menu entry that has children, it won't get the "expanded-dhtml" class?
Now when I click the bullet link, it first adds the "expanded-dhtml" class and only on clicking AGAIN it will exchange it with the "collapsed-dhtml" class. This means I have to click twice to collapse it.
Edit:
I fixed it, the problem is that the JS script only saves elements with the class "expanded-dhtml" into the cookie array. By clicking a link without expanding it first, it won't be saved into the cookie array, hence not loaded when the page is being build. As far as I can see there are two solutions to this:
1) Fix the JS to take in the clicked element
2) Change the preprocess function to set the current menu item to be expanded
Since I have just enough knowledge about JS to understand what is going on, I fixed it in the preprocess function for me. Solution feels kind of crude, but well - it's working. Here's the code:
Comment #10
michaelfavia CreditAttribution: michaelfavia commentedFixed the patch above to properly namespace the classes and removed some debugging. Comment #89 feels like a new issue but i undertsand why you put it here with the patch. Lets see if we can get this commited to the dev branch and test against that.
Comment #11
michaelfavia CreditAttribution: michaelfavia commentedRenaming issue for better clarity
Comment #12
michaelfavia CreditAttribution: michaelfavia commentedSorry for the bugspam but it looks like the currently active menu trail wasnt getting assigned the "dhtml-expanded" class because it was previousl maked as expanded by the menu module to begin with. Since we introduced our own handlers above (still not sure this is the best direction but it works for now) we need to set an initial state for expanded items ourselves.
Comment #13
michaelfavia CreditAttribution: michaelfavia commentedOk Christoph was foolish enough to give me git access. In an effort not to make him regret it on the first commit to the dev branch id like to make sure we all think that not using the menu provided "expanded/collapsed" css classes makes sense because of their possible unintended interaction with other modules like menu.module and fancy_menus, etc.
If you can test the latest patch on a clean d7 branch and we get a consensus ill commit this bad boy.
@chritoph your opinion would be very appreciated here because this is changing css selectors that were probably used externally in theming. Going to test myself tonight and see what conclusions we come to.
Comment #14
michaelfavia CreditAttribution: michaelfavia commentedRemove static init for ajax prevention and deal with that in the other issue.
Comment #15
tahiticlic CreditAttribution: tahiticlic commentedThe patch doesn't work on last dev version since on hiding, when "None" behavior is selected, the link is reached.
The definition of root and siblings should be outside the test in Drupal.dhtmlMenu.switchMenu function, leading to :
Comment #16
Arvid Herfjord CreditAttribution: Arvid Herfjord commentedQuick and dirty fix
Add the following to dhtml_menu.css:
That did it for me :-)
Comment #17
Rory CreditAttribution: Rory commentedI'm using the DHTML Menu 'Static navigation' > 'None' option and I found a decent workaround solution.
Enable 'Show as expanded' for each parent menu item under the items' menu settings. This applies to any items in a single menu that contain other menu items, including children that are parents of other menu items.
Comment #18
AjitSThe solution provided by @Arvid worked for me!
Comment #19
Rory CreditAttribution: Rory commentedThe initial collapsed or expanded class assigned to the HTML by the module needs to be looked at, instead of changing the CSS to disguise the problem. Hiding the issue is not the same as fixing it, it's making things worse :)
Until someone is able to submit a proper patch, this issue should remain open. @Arvid has admitted it's a dirty solution. You shouldn't have an item that is both collapsed AND expanded at the same time.
Comment #20
atiba CreditAttribution: atiba commented#17 Thanks Rory, your suggestion worked for me. Simply because 'Show as expanded' will provide a different class different then .collapsed.
It's a nice workaround, but definitely isn't a fix. I'm surprised this issue is for about 3 years now and still isn't patched yet.
Comment #21
BWPanda CreditAttribution: BWPanda commentedI'm also experiencing this issue (having both 'collapsed' and 'expanded' classes on list-items at the same time) and believe it is because there are two 'collapsed' classes on the same list-item; so when the code says to remove 'collapsed' and add 'expanded', it only removes one 'collapsed' and hence you get the problem.
This patch seems to fix the issue for me. Others should test to make sure it works for them too.
Comment #22
vuilUpdate the patch of #21 to the latest 7.x-1.x-dev branch.
Comment #24
vuilComment #26
vuil