From a1d2eebf2b5e66bdda09326903ca6472e803e3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Fri, 24 Apr 2026 18:10:10 +0400 Subject: [PATCH] Hide cookie details toggle for categories with no cookies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- packages/cookie-banner/src/components/category-list.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cookie-banner/src/components/category-list.ts b/packages/cookie-banner/src/components/category-list.ts index b449ee3e9..eb7005506 100644 --- a/packages/cookie-banner/src/components/category-list.ts +++ b/packages/cookie-banner/src/components/category-list.ts @@ -55,8 +55,6 @@ export class ProboCategoryList extends ProboElement { if (!this.template) return; for (const cat of categories) { - if (cat.cookies.length === 0) continue; - const wrapper = document.createElement("probo-category"); wrapper.setAttribute("name", cat.name); wrapper.setAttribute("slug", cat.slug); @@ -70,6 +68,12 @@ export class ProboCategoryList extends ProboElement { description: cat.description, }); + const hasCookies = cat.cookies && cat.cookies.length > 0; + if (!hasCookies) { + clone.querySelector("[data-action=toggle-cookies]")?.remove(); + clone.querySelector("probo-cookie-list")?.remove(); + } + wrapper.appendChild(clone); this.appendChild(wrapper); }