diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx index 66a87bca..17b3eb2d 100644 --- a/src/components/common/messaging/MessageBox.tsx +++ b/src/components/common/messaging/MessageBox.tsx @@ -477,8 +477,21 @@ export default observer(({ channel }: Props) => { return send(); } - if (e.key === "Escape" && replies.length > 0) { - setReplies(replies.slice(0, -1)); + if (e.key === "Escape") { + if (replies.length > 0) { + setReplies(replies.slice(0, -1)); + } else if ( + uploadState.type === "attached" && + uploadState.files.length > 0 + ) { + setUploadState({ + type: + uploadState.files.length > 1 + ? "attached" + : "none", + files: uploadState.files.slice(0, -1), + }); + } } debouncedStopTyping(true);