From 89f1fb00235771ffef512c7a7935c2ae3b85439b Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Thu, 23 Oct 2025 09:37:47 +0000 Subject: [PATCH] fix(BOOK-466): Setting chatbot z-index variable to -1 if the chatbot should be hidden to avoid issues when multiple tabs are open Approved-by: Linus Flood --- apps/scandic-web/components/ChatbotScript/Client.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/scandic-web/components/ChatbotScript/Client.tsx b/apps/scandic-web/components/ChatbotScript/Client.tsx index 84f1c1fd1..96e95ae0c 100644 --- a/apps/scandic-web/components/ChatbotScript/Client.tsx +++ b/apps/scandic-web/components/ChatbotScript/Client.tsx @@ -34,8 +34,13 @@ export function ChatbotClient({ liveLangs }: ChatbotClientProps) { if (!shouldShow) { window.kindlyChat.closeChat() window.kindlyChat.hideBubble() + // Hack to hide chatbot behind other elements in case the user has multiple tabs + // open and the chat window should not be visible in the tab that becomes active + document.documentElement.style.setProperty("--chatbot-z-index", "-1") } else { window.kindlyChat.showBubble() + // Reset z-index when chatbot is shown, we're using the default z-index from globals.css + document.documentElement.style.removeProperty("--chatbot-z-index") } } }, [shouldShow])