Skip to content

Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.

Fix: only register window click listener when dropdown is open

Anil Matcha11f850abfc73
diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsx
index 851c109c..66047982 100644
--- a/packages/studio/src/components/VideoStudio.jsx
+++ b/packages/studio/src/components/VideoStudio.jsx
@@ -317,10 +317,15 @@ export default function VideoStudio({ apiKey, onGenerationComplete, historyItems
// ── close dropdown on outside click ─────────────────────────────────────
useEffect(() => {
- const handler = () => setOpenDropdown(null);
+ if (!openDropdown) return;
+ const handler = (e) => {
+ const isInsideDropdown = [modelBtnRef, arBtnRef, durationBtnRef, resolutionBtnRef, qualityBtnRef, modeBtnRef]
+ .some(ref => ref.current && ref.current.contains(e.target));
+ if (!isInsideDropdown) setOpenDropdown(null);
+ };
window.addEventListener('click', handler);
return () => window.removeEventListener('click', handler);
- }, []);
+ }, [openDropdown]);
// ── textarea auto-resize ──────────────────────────────────────────────────
const handlePromptInput = (e) => {