diff --git a/frontend/src/lib/components/common/modal/Modal2.svelte b/frontend/src/lib/components/common/modal/Modal2.svelte
index fcce008ad7..c00bf758d0 100644
--- a/frontend/src/lib/components/common/modal/Modal2.svelte
+++ b/frontend/src/lib/components/common/modal/Modal2.svelte
@@ -8,6 +8,8 @@
import { X } from 'lucide-svelte'
import List from '$lib/components/common/layout/List.svelte'
import { fade } from 'svelte/transition'
+ import { zIndexes } from '$lib/zIndexes'
+ import { chatState } from '$lib/components/copilot/chat/sharedChatState.svelte'
interface Props {
title: string
@@ -85,6 +87,11 @@
function fadeFast(node: HTMLElement) {
return fade(node, { duration: 200 })
}
+
+ // Elevate above the AI chat panel (zIndexes.aiChat) while chat is open so
+ // the dialog isn't hidden behind it; otherwise keep the default modal
+ // stacking just above disposables (zIndexes.disposables).
+ const overlayZIndex = $derived(chatState.size > 0 ? zIndexes.aiChat + 1 : zIndexes.disposables + 10)
@@ -92,7 +99,8 @@
{#if isOpen}