Fixing the Shopify Dawn Theme's Mobile Menu Glitch: Overlapping 'X' Icon Explained

Hey there, fellow store owners! Ever logged onto your Shopify store from your phone, clicked that familiar hamburger menu icon, and found something… a little off? You know, those tiny visual glitches that can make your otherwise beautiful store look unprofessional? Well, you’re definitely not alone. The Shopify community is a treasure trove of insights for these exact moments, and I recently stumbled upon a thread that perfectly illustrates this, tackling a very specific but frustrating mobile menu issue in the popular Dawn theme.

Our friend @filials posted about a perplexing problem: on their mobile site (using the Dawn theme, no less!), the ‘X’ icon meant to close the hamburger menu was appearing on top of the menu icon itself, even when the menu wasn’t open! Talk about a visual hiccup. They even shared a screenshot, which really helped everyone grasp the issue:

This is the kind of detail that can really impact a customer’s first impression, especially since so many shoppers are browsing on their phones these days.

Right away, other community members jumped in. @Custom-Cursor hit on a very common culprit: “This usually happens when custom CSS or JavaScript is affecting the menu toggle, Have you recently made any code changes to the Dawn theme?” This is always the first question to ask yourself when something suddenly looks off. Did you install a new app? Tweak some code? Even minor changes can sometimes have unexpected ripple effects.

Interestingly, later in the thread, @devcoders checked @filials’s site and observed that the issue seemed to be resolved! This is a great reminder that sometimes, simply asking the question or letting the community look at it can lead to a fix, or perhaps the original poster found a solution on their own before the thread fully played out. But for those still grappling with it, the community didn’t stop there, offering some fantastic actionable advice.


The Direct CSS Solution: Hiding the 'X' When Not Needed

The most direct and widely applicable solution for this specific overlapping ‘X’ issue came from @Moeed. The problem, as @Moeed diagnosed, is that the ‘X’ (the close icon) is visible even when the menu is in its ‘closed’ state. The key is to hide it until the menu is actually expanded. This is done by targeting the menu icon’s state using CSS.

Here’s how @Moeed suggested fixing it, which is a classic example of a quick CSS tweak making a big difference:

Step-by-Step Instructions:

  1. Go to your Shopify Admin.
  2. Navigate to Online Store > Themes.
  3. Find your current theme (likely Dawn) and click Actions > Edit Code.
  4. In the theme editor, locate the theme.liquid file under the ‘Layout’ directory.
  5. Scroll to the very bottom of the theme.liquid file and add the following code snippet right above the tag:

This CSS snippet specifically targets the menu icon (.header__icon--menu) when its aria-expanded attribute is set to "false" (meaning the menu is closed). It then hides the SVG element with the ID svg within that context. The !important flag ensures this style overrides any conflicting styles.

After implementing this, @Moeed shared the ‘after’ results, showing a clean hamburger menu without the overlapping ‘X’:

     

Another Angle: Checking for Correct Icon Classes

@dinesh_kumar offered another valuable piece of advice: “@filials you haven’t added the class “icon icon-close” to the close svg icon. just add these classes to the close svg icon it will work” While @Moeed’s solution directly addresses the visibility of the icon based on the menu’s state, @dinesh_kumar points to a potential underlying structural issue. If the ‘X’ icon isn’t properly classed, it might not be styled or toggled correctly by the theme’s default JavaScript and CSS. This suggests that if @Moeed’s fix doesn’t quite work, or if your ‘X’ icon is missing entirely, you might need to dig into the SVG code for your close icon and ensure it has the necessary classes. This is a deeper dive, usually found in files like header.liquid or a specific SVG snippet file.

Why These Glitches Happen & Best Practices

Mobile menu issues, especially with icons, are often a result of custom code conflicting with theme updates, or perhaps an incomplete customization. The Dawn theme is constantly evolving, and sometimes a seemingly small change you make can interact unexpectedly with a new theme version.

If you’re making these kinds of code changes, remember a few golden rules:

  • Always Duplicate Your Theme: Before touching any code, go to Online Store > Themes > Actions > Duplicate. This creates a backup you can revert to if something goes wrong.
  • Test on Multiple Devices: What looks good on your phone might not look the same on a different model or operating system.
  • Use Browser Developer Tools: Learn to inspect elements in your mobile browser or desktop browser’s mobile view. This helps you identify conflicting CSS styles or missing elements.
  • Clear Cache: Sometimes, changes don’t appear immediately due to browser or CDN caching. Clear your browser cache or use an incognito window to see the latest version.

It’s incredible how a small piece of CSS can resolve a seemingly complex and annoying visual bug. This thread is a perfect example of the Shopify community coming together to offer practical, code-level solutions that empower store owners to maintain a polished and professional online presence. Keeping your mobile experience flawless is paramount, and thankfully, with a little help from the community, these little headaches are often easily fixable!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases