From 1bc1c3d978222d6b1344de42e1e072ec04a92699 Mon Sep 17 00:00:00 2001 From: leookun Date: Wed, 26 Aug 2026 15:50:53 +0800 Subject: [PATCH] merge old config --- apps/desktop/src/components/ui/Modal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/components/ui/Modal.tsx b/apps/desktop/src/components/ui/Modal.tsx index 9b9bd95..d4a7679 100644 --- a/apps/desktop/src/components/ui/Modal.tsx +++ b/apps/desktop/src/components/ui/Modal.tsx @@ -73,8 +73,10 @@ export function Modal({ id, open, title, children, banner, busy, wide, role = "d }; document.addEventListener("keydown", onKey); const focusFrame = requestAnimationFrame(() => { - const target = initialFocus === "submit" ? submitButton.current : focusableElements(dialog.current!)[0]; - (target ?? dialog.current)?.focus(); + const currentDialog = dialog.current; + if (!currentDialog) return; + const target = initialFocus === "submit" ? submitButton.current : focusableElements(currentDialog)[0]; + (target ?? currentDialog).focus(); }); return () => { cancelAnimationFrame(focusFrame);