diff --git a/components/email/ComposeEmail.tsx b/components/email/ComposeEmail.tsx index c89e353b..97df84f7 100644 --- a/components/email/ComposeEmail.tsx +++ b/components/email/ComposeEmail.tsx @@ -188,13 +188,8 @@ export default function ComposeEmail(props: ComposeEmailAllProps) { // Focus editor after initializing content setTimeout(() => { - // For new messages, focus the textarea - if (!type || type === 'new') { - const textarea = document.querySelector('textarea'); - textarea?.focus(); - } - // For replies/forwards, focus the contentEditable div - else if (['reply', 'reply-all', 'forward'].includes(type) && editorRef.current) { + if (editorRef.current && type !== 'new') { + // For replies/forwards, focus contentEditable editorRef.current.focus(); try { @@ -214,6 +209,10 @@ export default function ComposeEmail(props: ComposeEmailAllProps) { } catch (e) { console.error('Error positioning cursor:', e); } + } else { + // For new emails, focus the textarea + const textarea = document.querySelector('textarea'); + textarea?.focus(); } }, 100); } catch (error) {