I’m working on a WordPress site with a hamburger menu that has dropdown sections. Right now users can only click the small arrow icon to open submenus on mobile devices. When they tap anywhere else on the menu item, it just closes the whole menu instead of expanding the submenu.
The problem: The clickable zone for expanding submenus is too small on mobile. Users have to tap exactly on the tiny arrow which is not user friendly.
What I want: Make the whole menu item clickable so users can tap anywhere on the text or arrow to expand the submenu.
Here’s a simplified version of my menu structure:
<nav class="mobile-navigation">
<ul class="primary-menu">
<li class="menu-item"><a href="/blog/">Blog</a></li>
<li class="menu-item has-dropdown">
<a href="#" class="parent-link">Services
<span class="expand-arrow" tabindex="0">
<span class="arrow-icon">
<svg width="20px" height="12px" viewBox="0 0 20 12">
<path d="M1,1l9,9l9-9"></path>
</svg>
</span>
</span>
</a>
<button class="submenu-trigger">
<span class="sr-text">Toggle Submenu</span>
</button>
<ul class="dropdown-menu" style="display: none;">
<li><a href="/web-design/">Web Design</a></li>
<li><a href="/seo-services/">SEO Services</a></li>
<li><a href="/consulting/">Consulting</a></li>
</ul>
</li>
<li class="menu-item has-dropdown">
<a href="#" class="parent-link">Resources
<span class="expand-arrow" tabindex="0">
<span class="arrow-icon">
<svg width="20px" height="12px" viewBox="0 0 20 12">
<path d="M1,1l9,9l9-9"></path>
</svg>
</span>
</span>
</a>
<ul class="dropdown-menu" style="display: none;">
<li><a href="/tutorials/">Tutorials</a></li>
<li><a href="/downloads/">Downloads</a></li>
</ul>
</li>
</ul>
</nav>
Is there a CSS solution to make the entire width of parent menu items trigger the dropdown expansion instead of just the arrow? I want to avoid clicking on the text closing the menu completely.