From 11f76a509a363bce32df91169c9338f7e01360c9 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Thu, 23 Oct 2025 13:37:08 +0000 Subject: [PATCH] fix(BOOK-466): We needed to separate the z-index from window.kindlyChat to also cater for other languages Approved-by: Linus Flood --- .../components/ChatbotScript/Client.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/scandic-web/components/ChatbotScript/Client.tsx b/apps/scandic-web/components/ChatbotScript/Client.tsx index 96e95ae0c..5ca247c35 100644 --- a/apps/scandic-web/components/ChatbotScript/Client.tsx +++ b/apps/scandic-web/components/ChatbotScript/Client.tsx @@ -30,17 +30,21 @@ export function ChatbotClient({ liveLangs }: ChatbotClientProps) { }, []) useEffect(() => { + // 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 + if (!shouldShow) { + document.documentElement.style.setProperty("--chatbot-z-index", "-1") + } else { + // Reset z-index when chatbot is shown, we're using the default z-index from globals.css + document.documentElement.style.removeProperty("--chatbot-z-index") + } + if (window.kindlyChat) { 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])