Solving the Sticky Widget Problem: How to Fix Chat & Review Overlays on Shopify Dawn Mobile Menus
Hey there, fellow store owners! Let's talk about something that's probably annoyed more than a few of you: those persistent chat widgets and review badges that just won't get out of the way on mobile. You know the drill – a customer taps to open your navigation menu or tries to filter products, and BAM! A chat bubble or review badge is sitting right on top, blocking the 'Apply' button or critical menu items. Frustrating, right?
This is a super common pain point, especially for those of us running the popular Shopify Dawn theme. Luckily, our vibrant Shopify community is always on the case, and a recent discussion brought some really solid solutions to light. I wanted to break it down for you, drawing insights from the brilliant folks who chipped in on the thread.
The Problem: Widgets Overlapping Your Mobile UI
The core issue, as pointed out by 'kub' in the original discussion, is that floating elements like the Shopify Inbox chat widget or Google Customer Reviews badges often have a very high z-index. This CSS property dictates the stacking order of elements on a webpage. When these widgets have a higher z-index than your mobile menu or filter drawer, they end up sitting on top, making your site hard to navigate on smaller screens.
It's not just an aesthetic issue; it's a functional one. Imagine a customer trying to use your collection filters, only to find the 'Apply' button covered by a chat icon. They can't complete their action, get frustrated, and might just leave your store. We definitely don't want that!
The Community's Solution: Custom CSS with z-index and :has()
The good news is that the community, particularly 'kub' and 'devcoders', came up with a robust CSS solution. The strategy involves two main parts:
- Boosting the
z-indexof your critical UI elements (like the mobile menu and header) to ensure they stack above most widgets. - Temporarily hiding the problematic widgets when the menus are open, using the powerful
:has()pseudo-class.
'Steve_TopNewYork' also chimed in with a great point about checking individual widget settings, as some apps might have their own z-index controls. But for a broad fix, the CSS approach is often the most effective.
Here's the Code to Implement
This is the comprehensive CSS snippet that was shared and refined in the thread. It targets common chat and review widgets and ensures your menus are front and center.
@media(max-width:989px){
.mobile-facets,
body:has(#Details-menu-drawer-container[open]) .section-header{
z-index:2147483647!important
}
body:has(:is(
.mobile-facets__disclosure.menu-opening,
#Details-menu-drawer-container[open]
)) :is(
#shopify-chat,
#dummy-chat-button-iframe,
iframe#ShopifyChat,
merchant-widget,
google-merchant-widget,
#google_customer_reviews_badge,
[id^="___ratingbadge"],
iframe[src*="merchantwidget"],
iframe[src*="shopping/merchant"],
iframe[title*="Google" i][title*="store" i],
[id*="merchant" i][id*="widget" i],
[class*="merchant" i][class*="widget" i]
){
display:none!important
}
}
How to Implement This Fix
Don't worry, you don't need to be a coding wizard to get this working. Shopify makes it pretty straightforward to add custom CSS to your theme.
Follow these steps:
- Log in to your Shopify admin.
- Go to Online Store > Themes.
- Find your Dawn theme (or whichever theme you're using, but this code is optimized for Dawn). Click Actions > Edit code.
- In the left-hand sidebar, navigate to the Assets folder.
- Look for a file named
base.cssortheme.css(it might vary slightly, but these are common CSS files). If your theme has a "Custom CSS" section in the theme editor itself, that's even easier – use that! - Paste the code: Scroll to the very bottom of the CSS file or the Custom CSS field, and paste the entire code block provided above.
- Click Save.
- Test it out! Open your store on a mobile device or resize your browser window to mobile dimensions. Check your navigation menu and collection filter pages to ensure the widgets now disappear when the menus are open and reappear when they close.
A quick note on the code: the @media(max-width:989px) rule ensures these changes only apply on smaller screens, which is exactly what we want. The :has() pseudo-class is pretty powerful here, allowing the CSS to check if a parent element (like the body) 'has' a child element that is open (like the menu drawer). This is a modern CSS feature, so 'Steve_TopNewYork' rightly pointed out that older browsers might not support it fully, but most modern browsers do, giving you broad coverage.
This fix should make a noticeable difference in your mobile user experience, ensuring that your customers can navigate and filter products without any annoying obstructions. It's a fantastic example of how the Shopify community collaborates to solve real-world problems for merchants. Keep an eye on your site's performance and gather feedback – small tweaks like this can lead to big improvements in customer satisfaction and conversions!