Shopify Inbox Chat: Fixing Cut-Off Notification Badges on Mobile
Solving the Mystery of the Cut-Off Shopify Inbox Notification Badge
Hey everyone! Ever run into those little snags that make you scratch your head? We were just chatting in the community about one of those – specifically, how the Shopify Inbox chat notification badge can get cut off on mobile when you're using rounded corners. It's a small detail, but it can definitely impact the user experience. Let's dive into the solutions we uncovered!
A user named sawez brought up the issue, explaining that when they added border-radius to their chat widget, the notification badge (that little red circle with the number of unread messages) was getting clipped. They even shared a screenshot, which really helped visualize the problem:

The CSS causing the issue looked like this:
@media (max-width: 820px) {
inbox-online-store-chat iframe,
inbox-online-store-chat {
border-radius: 16px !important;
overflow: hidden;
}
}
As you can see, overflow: hidden was the culprit. While it created those nice rounded corners, it also chopped off part of the notification badge.
Community Solutions and Insights
StackingContext jumped in with a quick suggestion to try setting the overflow property to unset !important:
inbox-online-store-chat {
overflow: unset !important;
}
However, sawez mentioned that this didn't solve the problem. This is where things get interesting because it highlights the challenges of styling elements within Shadow DOM.
Then tim_1 came through with a more nuanced solution. He pointed out that you can't directly apply CSS rules to the inbox-online-store-chat children because they live in the Shadow DOM. Shadow DOM, for those who aren't familiar, is basically a way for web components to have their own encapsulated styles, preventing them from being affected by the main document's CSS. It's like a mini-website within a website!
Targeting the Open Chat Window
Tim_1 suggested targeting the open chat window instead of the chat button itself. This is a clever workaround! Here's the code:
@media (max-width: 820px) {
inbox-online-store-chat[is-open="true"] {
border-radius: 16px;
overflow: hidden;
}
}
The key here is the [is-open="true"] attribute selector. This tells the browser to only apply the styles when the chat window is actually open. This way, the notification badge on the closed chat button remains visible, and the open chat window still gets its rounded corners.
Putting It All Together: A Step-by-Step Guide
Okay, let's break down how to implement this fix on your Shopify store:
- Access your theme's code: From your Shopify admin, go to Online Store > Themes. Then, click Actions > Edit code.
- Locate your theme.liquid file: This is the main layout file for your theme.
- Add the CSS: Paste the following CSS code into your theme.liquid file, ideally within the
section, or in a separate CSS file if you have one, and link to it in thesection:@media (max-width: 820px) { inbox-online-store-chat[is-open="true"] { border-radius: 16px; overflow: hidden; } } - Adjust the
border-radius: Feel free to change the16pxvalue to whatever looks best on your store. - Save your changes: Click the Save button in the top-right corner of the code editor.
- Test on mobile: Clear your browser cache and check your store on a mobile device to make sure the notification badge is no longer cut off and the chat window has rounded corners when open.
This approach gives you the best of both worlds: rounded corners on the open chat window and a fully visible notification badge when the chat is closed. It's a great example of how understanding CSS specificity and Shadow DOM can help you overcome styling challenges in Shopify.
So, there you have it! A big thanks to sawez for bringing up the issue and to tim_1 for providing the elegant solution. It's these kinds of community discussions that make solving Shopify customization challenges so much easier!