fix(web): delay TitleEditor autofocus to avoid Dialog animation conflict

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-04-01 14:15:31 +08:00
parent c6e67bd41e
commit 946b4a277e

View file

@ -117,11 +117,13 @@ const TitleEditor = forwardRef<TitleEditorRef, TitleEditorProps>(
},
});
// Auto-focus after mount
// Auto-focus after mount — delay to wait for Dialog open animation
useEffect(() => {
if (autoFocus && editor) {
// Move cursor to end
editor.commands.focus("end");
const timer = setTimeout(() => {
editor.commands.focus("end");
}, 50);
return () => clearTimeout(timer);
}
}, [autoFocus, editor]);