0

Unfortunately, I do not have a way to reproduce this since I don't know what is causing the issue, but I can provide plenty of details. The problem is this:

In the nav bar the parent menu item works perfectly fine by itself, but as soon as I add sub-menu items beneath it the parent item becomes unclickable.

  • I assumed there must be some invisible element on top of the parent item that was preventing me from clicking it. From what I can tell, there is not element on top of the parent item.
  • I went into dev tools and set the sub-menu to display:none;. No change.
  • I set a z-index for the parent item of 9999. No change.
  • This behavior is consistent across all pages and in the mobile menu.

The only way I've found to fix it is to remove the sub-menu items so I know it must be related to them, but if the submenu is displaying what else could be making the parent item unclickable?

I'm out of ideas. What else could cause this behavior?

  • 2
    Are you sure this isn't a "feature" designed by your theme developer? I have seen plenty of sites that make the parent links not clickable because they want you to go to the child pages – RiddleMeThis Jan 9 at 21:02
  • 1
    yeah more than likely there's a class added to nav menu links with children and the some javascript targeting that class and putting a preventDefault on the click event – mrben522 Jan 9 at 21:11
  • omg you're right. dumbest feature ever. ` //Disable dropdown parent link $('.navigation li.menu-item-has-children > a').on('click', function(e) { e.preventDefault(); }); }` – Telarian Jan 9 at 21:15
  • 1
    @mrben522 post as an answer and I'll give it to you. – Telarian Jan 9 at 21:16
2

The issue is javascript targeting the menu-item-has-children class and adding a preventDefault to the click event. Pretty standard stuff but annoying when it's not an option you can choose to turn off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.