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
This commit is contained in:
Erik Tiekstra
2025-10-23 09:37:47 +00:00
parent 7f2db6f3de
commit 89f1fb0023

View File

@@ -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])