From 3a68f1787d5549d0a009476a8f52725aa7d14869 Mon Sep 17 00:00:00 2001 From: Mizarc Date: Wed, 1 Jul 2026 15:38:41 +1000 Subject: [PATCH] fix(app): auto focus Textarea when attaching files (#1238) --- .../src/features/channel/components/ChannelTextarea.tsx | 5 +++++ fluxer_app/src/features/channel/components/UploadManager.tsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fluxer_app/src/features/channel/components/ChannelTextarea.tsx b/fluxer_app/src/features/channel/components/ChannelTextarea.tsx index bf9fc017a..f8810fca9 100644 --- a/fluxer_app/src/features/channel/components/ChannelTextarea.tsx +++ b/fluxer_app/src/features/channel/components/ChannelTextarea.tsx @@ -575,6 +575,10 @@ const ChannelTextareaContent = observer( )), ); + return; + } + if (files.length > 0) { + textareaRef.current?.focus(); } }, [canAttachFiles, channel.id, textareaInputDisabled, maxAttachments, uploadAttachments.length]); const handleUploadMessageAsFile = useCallback(async () => { @@ -599,6 +603,7 @@ const ChannelTextareaContent = observer( } setValue(''); DraftCommands.deleteDraft(channel.id); + textareaRef.current?.focus(); }, [textareaInputDisabled, canAttachFiles, value, channel.id, uploadAttachments.length, maxAttachments]); useTextareaExpressionHandlers({ setValue, diff --git a/fluxer_app/src/features/channel/components/UploadManager.tsx b/fluxer_app/src/features/channel/components/UploadManager.tsx index 346791399..3ece2ce88 100644 --- a/fluxer_app/src/features/channel/components/UploadManager.tsx +++ b/fluxer_app/src/features/channel/components/UploadManager.tsx @@ -49,7 +49,9 @@ export const UploadManager = observer(({channel, canAttachFiles, canSendMessages ModalCommands.popWithKey(UPLOAD_DROP_MODAL_KEY); }, []); const focusTextarea = useCallback(() => { - ComponentDispatch.dispatch('FOCUS_TEXTAREA', {channelId: channel.id}); + setTimeout(() => { + ComponentDispatch.dispatch('FOCUS_TEXTAREA', {channelId: channel.id}); + }, 0); }, [channel.id]); const onDrop = useCallback( async (files: Array, directUpload = false) => {