codefog/contao-mobile_menu

closeOnLinkClick should not close on first click on submenu item

Closed this issue · 4 comments

Normally first click on submenu item just expands that submenu. The second click then jumps to the submenu page.
If closeOnLinkClick is activated, I think it should be the same: close the mobile_menu in these cases on the second click. Perhaps this could be done in mobile-menu.jquery.js near line 113, depending on the classes of the parentElement ('submenu_show' or 'submenu_hide'). But I couldn't get it working...

Thanks for any hint

Aybee commented

Why do you use closeOnLinkClick? I think it does what it says - closes the menu if you click on a link.

If you don't use closeOnLinkClick it closes when the browser loads another page.

Depends on what 'click on a link' means. As long as it just navigates through the menu without changing the page it's not 'really' clicking the link.

I'm experimenting with https://github.com/gmrchk/swup for nicer page transitions.
In this case the mobile menu stays on the page - similar to the one pager use case mentioned in the documentation of closeOnLinkClick.
I think, it should just close the menu if it really loads a new page.

Next problem then will be to update the menu to the new page...

Aybee commented

I think, it should just close the menu if it really loads a new page.

So you should not use closeOnLinkClick

Next problem then will be to update the menu to the new page...

The new page has a new menu so this is done anyway.

The new page has a new menu so this is done anyway.
No, but this is not an issue of mobile_menu. swup loads the next page (ajax) and replaces just main parts of the existing page. Maybe I should configure it to also replace the menu and its trigger. I'm still experimenting.
But again: here is not the correct place to discuss swup integration ;-)