Troubleshooting
Most CSS issues fall into four categories: scope (Shadow DOM), specificity, sanitizer stripping, or compliance validation.
My CSS doesn’t apply at all
Section titled “My CSS doesn’t apply at all”Possible causes and fixes:
-
You’re targeting elements outside the Shadow Root — selectors like
body,html, or your own page’s elements won’t work inside custom CSS. Target the consent UI’s own classes:.ag-banner/.ag-btnfor the banner,.ag-trigger-btnfor the privacy trigger, and.ag-popup*for the preferences popup (see the CSS Classes reference). A rule only applies inside the surface it belongs to, so a.ag-popup-btnrule doing nothing to the banner is expected, not a bug. -
A sanitizer pattern stripped your rule — check if the rule contains
@import,expression(), or any other blocked pattern. Open the editor, look at the saved CSS (not what you typed), and compare. -
Specificity — the recipe wins — template recipe styles sometimes use specificity higher than a plain class. Add the parent class to increase specificity:
/* Instead of: */.ag-btn { padding: 8px; }/* Try: */.ag-banner .ag-btn { padding: 8px; } -
Wrong property — check that you’re setting the CSS property that actually controls the visual. Many values are set via custom properties (tokens), so
background: blueon.ag-btnwon’t win overbackground: var(--btn-fill)unless you also override the token, or increase specificity beyond what the token-using rule has.
I’m getting HTTP 422 when saving
Section titled “I’m getting HTTP 422 when saving”HTTP 422 means the validation layer (not the sanitizer) found a policy violation. The response body lists each ValidationIssue. Common codes:
| Code | Cause | Fix |
|---|---|---|
css_too_long | CSS exceeds 10,000 characters | Reduce length; use token overrides instead of class-by-class rules |
branding_modification_attempted | CSS targets .ag-branding or descendants | Remove those selectors entirely. See Branding Policy |
banner_hiding_attempted | CSS would hide the banner, its button row, or the Reject all, Accept all or Customize button (the issue lists each declaration) | Remove those declarations. See Banner hiding |
The 422 response always includes a docsUrl field linking to the relevant docs page for each violation.
The branding is still showing even without CSS targeting it
Section titled “The branding is still showing even without CSS targeting it”The branding element is rendered whenever whiteLabel=false, which is the case on the free plan. Inline !important styles protect it at runtime regardless of custom CSS. There is no CSS-based workaround.
If you need a banner without the badge, the paid “No branding” plan removes the KookiOk branding your visitors see, and so does “Full”. See Branding Policy.
The compliance checker flags my CSS
Section titled “The compliance checker flags my CSS”The compliance checker checks for GDPR dark patterns regardless of whether you’re intentionally targeting them. Common false alarms:
| Flag | Likely cause | Fix |
|---|---|---|
reject_all_hidden | Your display:none rule matches too broadly | Narrow the selector so it doesn’t apply to .ag-btns or #ag-reject-all ([data-button="reject"]) |
buttons_visually_unequal | You styled one button differently from the others | Apply the same styles to all .ag-btn elements |
tap_target_too_small | min-height set below 44px on buttons | Keep min-height: 44px on .ag-btn |
The banner is positioned behind my site elements
Section titled “The banner is positioned behind my site elements”The .ag-banner uses z-index: 2147483647 (maximum integer). If a banner element still appears behind something on your site:
- Check if your site element has
transform,filter, orwill-change— these create a new stacking context, which resets z-index battles. - The
.ag-overlayalso hasz-index: 2147483646. Your site element may be inside a stacking context that sits above the overlay.
Fix: Add the problematic site element to a lower stacking context, or avoid transform/filter on high-z-index wrappers.
The preview in the editor doesn’t match the live site
Section titled “The preview in the editor doesn’t match the live site”The editor preview loads the real consent-runtime.js from the backend in preview mode. If the live site looks different:
- Verify the site has the latest
consent.jssnippet — clear cache and hard-reload. - Check if the live site has a Content Security Policy that blocks the banner script.
- Look for any global site CSS that uses
!importanton very broad selectors — though Shadow DOM blocks most of them, CSS custom properties (--var) can still pierce the boundary.