From dce7bb521e3947af59fe18895b609ec353e0450e Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 17 Jun 2026 12:23:43 -0700 Subject: Fix Cookiebot consent dialog rendering unstyled and breaking the page (#2108) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a fresh (no-consent) load the consent banner could render completely unstyled and expand to full page height. Cookiebot delivers its dialog CSS as a constructed stylesheet on document.adoptedStyleSheets; ReadTheDocs' readthedocs-addons.js reassigns that whole-array property with a destructive replace, and when that lands after Cookiebot's network-gated adoption it drops Cookiebot's sheet, leaving #CybotCookiebotDialog at position:static expanded to ~6700px. It is a race, so it is intermittent and clears once consent is given (the dialog then never renders). - layout.html: a small adoptedStyleSheets shim, installed before any page script, that preserves Cookiebot's sheet so another library cannot drop it. - custom.css: a leak-safe safety net that keeps the dialog contained even if its adopted sheet is ever absent. It uses only properties Cookiebot itself sets, so it has verifiably no effect on the normal, styled banner. 🤖 Generated by [robots](https://vyos.io) --- docs/_templates/layout.html | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'docs/_templates/layout.html') diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index fce69b86..07748192 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -2,6 +2,46 @@ {%- set current_version = "1.5.x circinus" %} {% block extrahead %} {% if gtm_id and cookiebot_id %} + {# Keep Cookiebot's consent dialog from rendering unstyled and breaking the page. + Cookiebot delivers its dialog CSS as a constructed stylesheet via + document.adoptedStyleSheets. That property holds the *whole* sheet list, and + ReadTheDocs' readthedocs-addons.js reassigns it with a destructive replace; when + that lands after Cookiebot's (network-gated) adoption it drops Cookiebot's sheet, + leaving #CybotCookiebotDialog at position:static, expanded to full page height. + This shim makes assignment preserve Cookiebot's sheet specifically. It must run + before the first adoptedStyleSheets write, so it is the first thing in . #} + + {# Cookiebot CMP — must load first so its auto-blocker can scan/block other tags #}