diff --git a/app/soapbox/features/compose/components/compose-form.tsx b/app/soapbox/features/compose/components/compose-form.tsx index ceea759514..ad67ff5d58 100644 --- a/app/soapbox/features/compose/components/compose-form.tsx +++ b/app/soapbox/features/compose/components/compose-form.tsx @@ -89,6 +89,7 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab const [composeFocused, setComposeFocused] = useState(false); + const firstRender = useRef(true); const formRef = useRef(null); const spoilerTextRef = useRef(null); const autosuggestTextareaRef = useRef(null); @@ -214,10 +215,13 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab }, []); useEffect(() => { - if (spoiler && !prevSpoiler) { - focusSpoilerInput(); + if (firstRender.current) { + focusTextarea(); + firstRender.current = false; } else if (!spoiler && prevSpoiler) { focusTextarea(); + } else if (spoiler && !prevSpoiler) { + focusSpoilerInput(); } }, [spoiler]); @@ -320,21 +324,22 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab id='compose-textarea' > { - !condensed && - - - + !condensed && ( + + + - + - - + + + ) } diff --git a/app/soapbox/hooks/index.ts b/app/soapbox/hooks/index.ts index 1da5fb9e4f..98d6005471 100644 --- a/app/soapbox/hooks/index.ts +++ b/app/soapbox/hooks/index.ts @@ -22,4 +22,4 @@ export { useRegistrationStatus } from './useRegistrationStatus'; export { useSettings } from './useSettings'; export { useSoapboxConfig } from './useSoapboxConfig'; export { useSystemTheme } from './useSystemTheme'; -export { useTheme } from './useTheme'; \ No newline at end of file +export { useTheme } from './useTheme';