From 7a4c82e563078a8a4154f96b2dd5a7d93eadb6dc Mon Sep 17 00:00:00 2001 From: martincupela Date: Fri, 14 Nov 2025 11:18:31 +0100 Subject: [PATCH] fix: prevent closing EditMessageForm on non-sbumit button click --- src/components/Attachment/Geolocation.tsx | 1 + .../Attachment/__tests__/__snapshots__/Card.test.js.snap | 6 ++++++ src/components/Attachment/components/PlayButton.tsx | 1 + src/components/Attachment/components/PlaybackRateButton.tsx | 1 + .../AttachmentPreviewList/FileAttachmentPreview.tsx | 1 + .../AttachmentPreviewList/GeolocationPreview.tsx | 1 + .../AttachmentPreviewList/ImageAttachmentPreview.tsx | 1 + .../AttachmentPreviewList/UnsupportedAttachmentPreview.tsx | 1 + .../AttachmentPreviewList/VoiceRecordingPreview.tsx | 1 + .../__snapshots__/AttachmentPreviewList.test.js.snap | 2 ++ 10 files changed, 16 insertions(+) diff --git a/src/components/Attachment/Geolocation.tsx b/src/components/Attachment/Geolocation.tsx index 9b67a3a519..5bac5f74ab 100644 --- a/src/components/Attachment/Geolocation.tsx +++ b/src/components/Attachment/Geolocation.tsx @@ -60,6 +60,7 @@ export const Geolocation = ({ diff --git a/src/components/Attachment/__tests__/__snapshots__/Card.test.js.snap b/src/components/Attachment/__tests__/__snapshots__/Card.test.js.snap index eedea8c26b..96a03ef8c8 100644 --- a/src/components/Attachment/__tests__/__snapshots__/Card.test.js.snap +++ b/src/components/Attachment/__tests__/__snapshots__/Card.test.js.snap @@ -41,6 +41,7 @@ exports[`Card (1) should render card without caption if attachment type is audio diff --git a/src/components/Attachment/components/PlaybackRateButton.tsx b/src/components/Attachment/components/PlaybackRateButton.tsx index 9e6875742d..ba51a4d460 100644 --- a/src/components/Attachment/components/PlaybackRateButton.tsx +++ b/src/components/Attachment/components/PlaybackRateButton.tsx @@ -7,6 +7,7 @@ export const PlaybackRateButton = ({ children, onClick }: PlaybackRateButtonProp className='str-chat__message_attachment__playback-rate-button' data-testid='playback-rate-button' onClick={onClick} + type='button' > {children} diff --git a/src/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.tsx b/src/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.tsx index 21e582bc47..1494a890cd 100644 --- a/src/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.tsx @@ -43,6 +43,7 @@ export const FileAttachmentPreview = ({ attachment.localMetadata?.id && removeAttachments([attachment.localMetadata?.id]) } + type='button' > diff --git a/src/components/MessageInput/AttachmentPreviewList/GeolocationPreview.tsx b/src/components/MessageInput/AttachmentPreviewList/GeolocationPreview.tsx index 32c61c989d..8faa174ef8 100644 --- a/src/components/MessageInput/AttachmentPreviewList/GeolocationPreview.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/GeolocationPreview.tsx @@ -36,6 +36,7 @@ export const GeolocationPreview = ({ className='str-chat__attachment-preview-delete' data-testid='location-preview-item-delete-button' onClick={remove} + type='button' > diff --git a/src/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.tsx b/src/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.tsx index 879b2e8bf8..1210f1e348 100644 --- a/src/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.tsx @@ -36,6 +36,7 @@ export const ImageAttachmentPreview = ({ data-testid='image-preview-item-delete-button' disabled={uploadState === 'uploading'} onClick={() => id && removeAttachments([id])} + type='button' > diff --git a/src/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.tsx b/src/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.tsx index abe94a44dc..e706bfe988 100644 --- a/src/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.tsx @@ -40,6 +40,7 @@ export const UnsupportedAttachmentPreview = ({ attachment.localMetadata?.id && removeAttachments([attachment.localMetadata?.id]) } + type='button' > diff --git a/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.tsx b/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.tsx index 845e4ac0a0..14a08339e2 100644 --- a/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.tsx +++ b/src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.tsx @@ -43,6 +43,7 @@ export const VoiceRecordingPreview = ({ onClick={() => attachment.localMetadata?.id && removeAttachments([attachment.localMetadata.id]) } + type='button' > diff --git a/src/components/MessageInput/__tests__/__snapshots__/AttachmentPreviewList.test.js.snap b/src/components/MessageInput/__tests__/__snapshots__/AttachmentPreviewList.test.js.snap index 7cdd12ce42..b66b86831f 100644 --- a/src/components/MessageInput/__tests__/__snapshots__/AttachmentPreviewList.test.js.snap +++ b/src/components/MessageInput/__tests__/__snapshots__/AttachmentPreviewList.test.js.snap @@ -25,6 +25,7 @@ exports[`AttachmentPreviewList should render custom BaseImage component 1`] = ` class="str-chat__attachment-preview-delete" data-testid="image-preview-item-delete-button" disabled="" + type="button" >