clicky-menus icon indicating copy to clipboard operation
clicky-menus copied to clipboard

Submenu does not close when clicking a top-level anchor link

Open utrenkner opened this issue 3 years ago • 1 comments

The demo features a main menu entry "home" without a submenu. If any submenu is expanded, a click on the main menu entry without submenu leaves it open.

Example: I click on "Services" and the relative sub-menu is expanded. When I then click on "Home" the Services-sub-menu remains expanded. This is an issue only if you are already on the "Home" page, however. In any other case, a click would lead you to another page.

I did not find in the JavaScript, which code prevents a click on Home to contract the other sub-menu. Should not be difficult to fix, though.

utrenkner avatar May 05 '21 10:05 utrenkner

This is a good point but may only be a real issue in the demo itself. I suppose it's still a bug, but it feels like a very minor one.

On almost every site I visit, the home link will refresh the page (and therefore "close" the submenu) even when viewing the home page. Are you doing something different on your sites? (Can you share a link if so?)

The submenu-closing logic is contained within the submenu-opening logic, so it doesn't get evaluated if there's no submenu to open. I'm unsure this is worth restructuring a lot of code to accomplish, but I think this issue can remain open in case that happens for another reason in the future and this can be addressed at that time.

mrwweb avatar May 05 '21 15:05 mrwweb

I can't think of a real example where this would be a problem outside of the demo itself, so I'm closing this. If anyone can provide a real-world use case for this, I'll be happy to reopen!

mrwweb avatar Nov 07 '22 23:11 mrwweb