Skip to content

Commit 22e0702

Browse files
authored
fix: focus textarea upon file input change event (#2752)
1 parent 43cf35b commit 22e0702

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/ReactFileUtilities/UploadButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const UploadFileInput = forwardRef(function UploadFileInput(
5050
ref: React.ForwardedRef<HTMLInputElement>,
5151
) {
5252
const { t } = useTranslationContext('UploadFileInput');
53-
const { cooldownRemaining } = useMessageInputContext();
53+
const { cooldownRemaining, textareaRef } = useMessageInputContext();
5454
const messageComposer = useMessageComposer();
5555
const { attachmentManager } = messageComposer;
5656
const { isUploadEnabled } = useAttachmentManagerState();
@@ -63,9 +63,10 @@ export const UploadFileInput = forwardRef(function UploadFileInput(
6363
const onFileChange = useCallback(
6464
(files: Array<File>) => {
6565
attachmentManager.uploadFiles(files);
66+
textareaRef.current?.focus();
6667
onFileChangeCustom?.(files);
6768
},
68-
[onFileChangeCustom, attachmentManager],
69+
[onFileChangeCustom, attachmentManager, textareaRef],
6970
);
7071

7172
return (

0 commit comments

Comments
 (0)