Message Input: Focus after clsing Attachment Modal

This commit is contained in:
Alexander Zinchuk 2021-08-20 23:47:24 +03:00
parent 0079e21906
commit 2015b1a0d9
3 changed files with 5 additions and 3 deletions

View File

@ -244,7 +244,7 @@ const AttachmentModal: FC<OwnProps> = ({
placeholder={lang('Caption')}
onUpdate={onCaptionUpdate}
onSend={onSend}
shouldSetFocus={isOpen}
shouldSetFocus={Boolean(attachments.length)}
/>
</div>
</div>

View File

@ -919,7 +919,7 @@ const Composer: FC<OwnProps & StateProps & DispatchProps> = ({
: botKeyboardPlaceholder || lang('Message')
}
forcedPlaceholder={inlineBotHelp}
shouldSetFocus={isSymbolMenuOpen}
shouldSetFocus={!attachments.length}
shouldSuppressFocus={IS_SINGLE_COLUMN_LAYOUT && isSymbolMenuOpen}
shouldSuppressTextFormatter={isEmojiTooltipOpen || isMentionTooltipOpen || isInlineBotTooltipOpen}
onUpdate={setHtml}

View File

@ -329,7 +329,9 @@ const MessageInput: FC<OwnProps & StateProps & DispatchProps> = ({
return;
}
focusInput();
if (shouldSetFocus) {
focusInput();
}
}, [currentChatId, focusInput, replyingToId, shouldSetFocus]);
useEffect(() => {