mirror of
https://github.com/Anil-matcha/Open-Generative-AI.git
synced 2026-05-07 01:17:18 +00:00
Fix: only register window click listener when dropdown is open
This commit is contained in:
parent
7ba63548d7
commit
11f850abfc
1 changed files with 7 additions and 2 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue