- This topic has 5 replies, 2 voices, and was last updated 5 months, 2 weeks ago by
Fernando.
-
AuthorPosts
-
October 5, 2022 at 11:11 am #2364450
Michael
We’ve developed a child theme in GP to serve as our main theme for a multisite install. I’ve always heard that OnClick for menus is more accessible but when I set the Navigation Dropdown to Click – Menu Item it seems to work for the most part in desktop except it looks like child menus overlap each other because when the cursor roles off of one, it doesn’t hide it but overlap each other. I demonstrate this in the first part of the video which I’ve included a link to. I’m finding a similar issue in mobile where a user almost gets lost trying to navigate.
When I switch it back to hover, it seems to work fine as demonstrated in the second half of the video.
I’d like to remain with the OnClick version but would like your thoughts. I’ve deactivated every plugin I can that is not network activated and still no joy.
Can this overlap issue be resolved?
Is OnClick better than Hover in regards to accessibility?I’ve also included a link to my test site.
Thanks much,
Mike
October 5, 2022 at 7:13 pm #2364683Fernando Customer Support
Hi Michael,
Did you add this custom code?:
.dropdown-click .main-navigation ul ul ul, .dropdown-click .secondary-navigation ul ul ul { left: 100% !important; top: 0 !important; position: absolute !important; }
If you remove that, the style would return to the previous one, wherein the overlap shouldn’t occur.
October 6, 2022 at 9:33 am #2365475Michael
Thanks Fernando! That worked. Is there anyway to align the child menus of sub menus expand to the right (versus vertical expanding) without breaking it like I did? Thanks again.
October 6, 2022 at 6:47 pm #2365755Fernando Customer Support
Well, you’d need a JS code for that which would be out of our scope of support.
Something simpler would be to just automatically close a submenu once another is opened.
To do this, create a Hook Element, and add this code:
<script> var parentElementLinks = document.querySelectorAll('.menu-item-has-children > a'); for (var k = 0; k < parentElementLinks.length; k++) { parentElementLinks[k].addEventListener('click', function() { console.log("Hello! I am an alert box!!"); var _this = this; var openedSubMenus = _this.closest('ul').querySelectorAll('ul.toggled-on'); if (openedSubMenus) { for (var o = 0; o < openedSubMenus.length; o++) { openedSubMenus[o].classList.remove('toggled-on'); openedSubMenus[o].closest('li').classList.remove('sfHover'); } } }, true); } </script>
Hook it to
wp_footer
and set it to display on your entire site.October 11, 2022 at 8:16 am #2370061Michael
Thank you again Fernando. I’ll mark this as resolved. Appreciate it.
October 11, 2022 at 5:06 pm #2370471Fernando Customer Support
You’re welcome Michael!
-
AuthorPosts
- You must be logged in to reply to this topic.