Skip to content

Commit a4f1fff

Browse files
authored
fix: prevent closing EditMessageForm on non-sbumit button click (#2884)
1 parent 0d19777 commit a4f1fff

File tree

10 files changed

+16
-0
lines changed

10 files changed

+16
-0
lines changed

src/components/Attachment/Geolocation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const Geolocation = ({
6060
<button
6161
className='str-chat__message-attachment-geolocation__stop-sharing-button'
6262
onClick={() => channel?.stopLiveLocationSharing(location)}
63+
type='button'
6364
>
6465
{t('Stop sharing')}
6566
</button>

src/components/Attachment/__tests__/__snapshots__/Card.test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ exports[`Card (1) should render card without caption if attachment type is audio
4141
<button
4242
class="str-chat__message-attachment-audio-widget--play-button"
4343
data-testid="play-audio"
44+
type="button"
4445
>
4546
<svg
4647
fill="none"
@@ -258,6 +259,7 @@ exports[`Card (7) should render audio with caption using og_scrape_url and with
258259
<button
259260
class="str-chat__message-attachment-audio-widget--play-button"
260261
data-testid="play-audio"
262+
type="button"
261263
>
262264
<svg
263265
fill="none"
@@ -470,6 +472,7 @@ exports[`Card (10) should render audio without title if attachment type is audio
470472
<button
471473
class="str-chat__message-attachment-audio-widget--play-button"
472474
data-testid="play-audio"
475+
type="button"
473476
>
474477
<svg
475478
fill="none"
@@ -667,6 +670,7 @@ exports[`Card (13) should render audio without title and with caption using og_s
667670
<button
668671
class="str-chat__message-attachment-audio-widget--play-button"
669672
data-testid="play-audio"
673+
type="button"
670674
>
671675
<svg
672676
fill="none"
@@ -851,6 +855,7 @@ exports[`Card (16) should render audio widget with title & text in Card content
851855
<button
852856
class="str-chat__message-attachment-audio-widget--play-button"
853857
data-testid="play-audio"
858+
type="button"
854859
>
855860
<svg
856861
fill="none"
@@ -1384,6 +1389,7 @@ exports[`Card (25) should render audio widget with image loaded from thumb_url a
13841389
<button
13851390
class="str-chat__message-attachment-audio-widget--play-button"
13861391
data-testid="play-audio"
1392+
type="button"
13871393
>
13881394
<svg
13891395
fill="none"

src/components/Attachment/components/PlayButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const PlayButton = ({ isPlaying, onClick }: PlayButtonProps) => (
1111
className='str-chat__message-attachment-audio-widget--play-button'
1212
data-testid={isPlaying ? 'pause-audio' : 'play-audio'}
1313
onClick={onClick}
14+
type='button'
1415
>
1516
{isPlaying ? <PauseIcon /> : <PlayTriangleIcon />}
1617
</button>

src/components/Attachment/components/PlaybackRateButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const PlaybackRateButton = ({ children, onClick }: PlaybackRateButtonProp
77
className='str-chat__message_attachment__playback-rate-button'
88
data-testid='playback-rate-button'
99
onClick={onClick}
10+
type='button'
1011
>
1112
{children}
1213
</button>

src/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const FileAttachmentPreview = ({
4343
attachment.localMetadata?.id &&
4444
removeAttachments([attachment.localMetadata?.id])
4545
}
46+
type='button'
4647
>
4748
<CloseIcon />
4849
</button>

src/components/MessageInput/AttachmentPreviewList/GeolocationPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const GeolocationPreview = ({
3636
className='str-chat__attachment-preview-delete'
3737
data-testid='location-preview-item-delete-button'
3838
onClick={remove}
39+
type='button'
3940
>
4041
<CloseIcon />
4142
</button>

src/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const ImageAttachmentPreview = ({
3636
data-testid='image-preview-item-delete-button'
3737
disabled={uploadState === 'uploading'}
3838
onClick={() => id && removeAttachments([id])}
39+
type='button'
3940
>
4041
<CloseIcon />
4142
</button>

src/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const UnsupportedAttachmentPreview = ({
4040
attachment.localMetadata?.id &&
4141
removeAttachments([attachment.localMetadata?.id])
4242
}
43+
type='button'
4344
>
4445
<CloseIcon />
4546
</button>

src/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const VoiceRecordingPreview = ({
4343
onClick={() =>
4444
attachment.localMetadata?.id && removeAttachments([attachment.localMetadata.id])
4545
}
46+
type='button'
4647
>
4748
<CloseIcon />
4849
</button>

src/components/MessageInput/__tests__/__snapshots__/AttachmentPreviewList.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ exports[`AttachmentPreviewList should render custom BaseImage component 1`] = `
2525
class="str-chat__attachment-preview-delete"
2626
data-testid="image-preview-item-delete-button"
2727
disabled=""
28+
type="button"
2829
>
2930
<svg
3031
data-testid="close-no-outline"
@@ -98,6 +99,7 @@ exports[`AttachmentPreviewList should render custom BaseImage component 1`] = `
9899
class="str-chat__attachment-preview-delete"
99100
data-testid="image-preview-item-delete-button"
100101
disabled=""
102+
type="button"
101103
>
102104
<svg
103105
data-testid="close-no-outline"

0 commit comments

Comments
 (0)