Problem/Motivation
In Version 9.2, dropdown menus do not work at all when more than 2 levels of menu selected.
second-level-navigation.js?v=9.2.0:21 Uncaught TypeError: Cannot read property 'classList' of null
at second-level-navigation.js?v=9.2.0:21
at NodeList.forEach (<anonymous>)
at toggleSubNav (second-level-navigation.js?v=9.2.0:19)
at HTMLLIElement.<anonymous> (second-level-navigation.js?v=9.2.0:62)
Steps to reproduce
Create a main menu of three or more levels. In admin/structure/block/manage/olivero_main_menu set to display 4 menu levels and expand all menu links.
Proposed resolution
Rewrite second-level-navigation.js so that it can cater for more than two levels of menu. This was possible in the javascript for the 9.1 version of Olivero (albeit with some tweaking of the js)
Comments
Comment #2
NewZeal commentedComment #3
mherchelWe don't support more than two levels. Note if we ever do support more than 3, we will likely need to figure out a different solution for #3190120: Olivero: Focused level-2 nav items should always be in viewport during keyboard navigation., which sets
overflow: auto;around the dropdowns. This would clip any third level menus.Comment #4
mherchelComment #5
jaime_pomales commentedDefinitely concur with New Zeal here. second-level-navigation.js is broken in 9.2.2.
If, in the menu block, you specify any level over 2, the drop down menus disappear completely as reported above.
I understand developer time is limited, so I understand not explicitly supporting level 3 and above, but to break the menus completely seems excessive to me.
Comment #6
mherchelyeah, you're right. we should handle this gracefully. I opened #3225241: Olivero primary menu JS completely breaks if site-builder specifies over 2 levels deep
Comment #7
andy-blumI've added a patch to mherchel's issue above, reviews & feedback appreciated
Comment #8
jaime_pomales commentedThanks for looking at this. I applied the patch from the newly opened issue and it works perfectly.
Thank you so much, Andy. As we say in Puerto Rico, ¡Eres un ángel!
Comment #9
mherchelWe'll do styling of the menu in this issue. Going to postpone this until #3225241: Olivero primary menu JS completely breaks if site-builder specifies over 2 levels deep is committed.
Comment #10
mherchelAttached is an initial patch with some styling work for when we get to this.
Comment #13
shaalIs this issue unblocked now?
(or what needs to be done to get it unblocked?)
Comment #14
stopopol commented+1
Comment #15
mherchelYeah, there's nothing blocking this at this point.
Comment #16
andy-blumThis is unblocked, but is it still an issue?
Comment #18
smustgrave commentedClosing out as there hasn't been a follow up #16 but if still a valid request please reopen
Thanks!
Comment #19
szaszg commentedHello andy-blum,
How can i produce this menu?
I try it with 10.1.8 and 10.4.1 but only "First submenu" appear...
Thanks,
Gergely