Top level links on shaperssurf.com mega menu arent working on click but are working fine on right click ( Fins > Thruster Fins, Longboard Fins… etc)
We have another site shapers.com.au that uses the exact same theme and menu and we arent having this issue. mega menu is working fine.
There is a difference in the code that is generated on the links on the 2 websites….
Shaperssurf.com
<a class="navPage-subMenu-action navPages-action navPages-action-depth-max has-subMenu" href="https://shaperssurf.com/longboard/" data-collapsible="navPages-1125" aria-label="Longboard Fins" aria-controls="navPages-1125" aria-expanded="true">
<span>Longboard Fins</span><i class="icon navPages-action-moreIcon" aria-hidden="true"><svg><use xlink:href="#icon-chevron-down"></use></svg></i>
</a>
shapers.com.au
<a class="navPage-subMenu-action navPages-action navPages-action-depth-max has-subMenu" href="https://shapers.com.au/shaping-blocks-1/">
<span>Shaping Blocks</span><i class="icon navPages-action-moreIcon" aria-hidden="true"><svg><use xlink:href="#icon-chevron-down"></use></svg></i>
</a>
I have tried disabling some javascript files to see if that would help but nothing seems to work
any help would be greatly appreciated.
2
Answers
I pasted the Shaperssurf.com code in a html with the basic html, and it worked.
I just pasted your code in Visual Studio Code and it works. But it seams that there is some type of error in some like break or what.
Take a look:
Image with error
But when I just deleted some line breaks.
Fixed?
Resuming
When the code is pasted in VsCode there some type of error in the line breaks, but with the ‘error’ or ‘fixed’ it works normal for me.
Based on the code you provided, there is a difference between the two
<a>
tags. The<a>
tag forshaperssurf.com
has the attributesdata-collapsible
,aria-label
,aria-controls
, andaria-expanded
, while the<a>
tag forshapers.com.au
does not.These extra attributes on the
shaperssurf.com
link suggest there might be some sort of collapsible or dropdown behavior attached to it, possibly with JavaScript.Here’s what you can do to troubleshoot and resolve the issue:
JavaScript Interference: Since the problem is with the top-level links not working on a regular click but working on a right-click, there might be some JavaScript preventing the default click behavior. Search for any event listeners attached to these links or their parent elements that might prevent the default behavior. Tools like the browser’s developer console (right-click on the element -> Inspect -> Event Listeners tab) can help with this.
Collapsible Behavior: The attributes suggest some sort of collapsible functionality. If there’s JavaScript associated with this behavior, it might be preventing the default link action to instead trigger the collapse/expand action.
CSS Issues: Sometimes, invisible overlaying elements due to CSS can block clicks. Use the browser’s developer tools to inspect elements and see if there’s anything overlaying your links.
Theme Consistency: If both sites are using the same theme, ensure they are also using the same version of the theme. Sometimes, subtle changes or updates in themes can cause unexpected behaviors.
Other Plugins/Scripts: Other plugins or scripts may interfere. It seems you’ve already tried disabling some scripts, but consider deactivating plugins (one by one) to see if there’s a particular one causing the issue. Remember to clear the cache each time you deactivate a plugin to see the change in behavior.
Check Console Errors: Open the browser’s developer tools and check the console for any JavaScript errors. Errors might point you to the problematic script or function.
Update & Backup: Ensure everything (theme, plugins, core) is updated to its latest version. Sometimes bugs are fixed in newer releases. But, always backup before updating!
Theme Customizations: If you’ve made customizations directly to the theme, consider testing on a child theme or revert to the original theme to see if customizations are causing the issue.
External Scripts: Any third-party scripts or tracking codes (like analytics, chatbots, etc.) can sometimes conflict with site functionality. Check if you have any such scripts running on
shaperssurf.com
but not onshapers.com.au
.If after all these steps the issue still persists, consider seeking help from a professional developer or the support team of the theme you are using. They might be more familiar with the nuances of the theme and can provide a quicker solution.