Skip to content

Notes · Opinion

Your theme should never have to know your AI receptionist is there

A chat plugin that needs custom CSS to survive your theme has put its job on your plate. Here is why we walled ours off, what that costs, and a two-minute test for any widget.

By Jay Callicott, NextAgency · · 4 min read

A well-coded WordPress theme should never have to know your AI receptionist is there. If a chat plugin needs custom CSS before it looks right on your site, the plugin has handed its job to you.

That is a strong position, and anyone who has looked after WordPress sites for a while has seen why.

Where this comes from

If you have run WordPress sites for a while, you know the pattern. A theme update or a page builder changes a global rule, a plugin’s button or popup suddenly looks wrong, and someone writes a few lines of CSS to patch it.

Every patch like that has the same problem. It is a fix written against two things that both change: the theme and the plugin. Either one updates, and the patch quietly stops working. Nobody notices until a visitor does.

So when we built the chat widget for Agent Front Desk, the first rule was that your theme and our widget should not be able to touch each other at all.

What we actually did

The widget is drawn inside a shadow root. That is a browser feature that gives a piece of the page its own private stylesheet. Our styles are injected inside it. Your theme’s styles stay outside it. The very first rule in our widget stylesheet is :host { all: initial; }, which resets everything the widget would otherwise inherit from your page, such as your body font size, line height or text color.

That is true for every way the assistant appears on your site: the floating launcher, the inline chat block you can drop into a page, and the callback form.

The honest part of the story is that the only styling bug we have shipped so far was ours, not a theme’s. Inside that private stylesheet, our own layout rules beat the browser’s default for hidden elements, so a panel that should have been hidden still showed. The fix was one line in our stylesheet, [hidden] { display: none !important; }, and a test that checks it. No theme was involved, and no site owner had to write anything.

We have run it on our own demo theme, Harborline. I am not going to claim it has been tested on every theme in the directory, because it has not. The point of the design is that it should not need to be.

The case for the other side

Here is the best version of the argument against me.

“My site has a heavily customized theme. I always need a few lines of CSS to make plugins fit. That is normal, and it is how my site ends up looking like one product instead of ten.”

That is fair, and parts of it are right.

A walled-off widget does not pick up your theme’s fonts. Ours uses the visitor’s system font, the same one their phone or laptop uses for everything else. If your brand is built on a particular typeface, the chat panel will not match it, and no stylesheet of yours can change that.

You also get fewer knobs. Today you set one brand color, choose whether the launcher sits on the left or the right, and the panel follows the visitor’s light or dark setting. That is it. A designer who wants to restyle every bubble will find that limiting.

Why I still disagree

Matching the font is a nice-to-have. The widget showing up broken on a phone, because a theme update changed how buttons are styled, is a lost lead you never hear about.

Every line of CSS you write to fit a plugin into your theme is a line you now maintain against two moving targets. A widget that cannot be reached by your theme removes that whole category of work. If the widget needs to look different, that belongs in its settings, where it survives updates on both sides, and not in your stylesheet.

I would rather give you one brand color that always works than fifty CSS hooks that work until the next update.

A two-minute test for any chat widget

You can check this on any plugin, ours or anyone else’s, before you buy it.

  1. Open a page with the widget on it, right-click the launcher, and choose Inspect. Look at what contains it. If you see #shadow-root or an iframe, it is walled off. If you see ordinary page markup, your theme can reach it.

  2. Open the browser console on the same page and paste this. It adds a deliberately ugly rule to the page:

    document.head.insertAdjacentHTML('beforeend', '<style>body{font:italic 24px/3 serif!important;color:red!important}button,input,textarea{all:unset!important}</style>')
  3. Open the chat. If it still looks and works the same, your theme cannot break it either. If it turned red, italic and huge, so will the next theme update.

Reload the page and the test rule is gone.

Tell me where I am wrong

If you run a heavily customized theme and you think a chat widget should inherit it, I want to hear the case. What would you lose if your chat widget could never be styled by your theme? Email me at [email protected]. I read every reply.

Want it on your WordPress site?

The private beta has limited spots, and each one is set up by hand. Tell us about your site and your CRM.

You get a written scope and quote before anything is built. No obligation, and a person replies.