diff --git a/src/components/Dialog/FormDialog.tsx b/src/components/Dialog/FormDialog.tsx index a19d13404..4cc1525d6 100644 --- a/src/components/Dialog/FormDialog.tsx +++ b/src/components/Dialog/FormDialog.tsx @@ -139,6 +139,7 @@ export const FormDialog = < diff --git a/src/components/MessageInput/EditMessageForm.tsx b/src/components/MessageInput/EditMessageForm.tsx index 33075d858..aa224f633 100644 --- a/src/components/MessageInput/EditMessageForm.tsx +++ b/src/components/MessageInput/EditMessageForm.tsx @@ -58,6 +58,7 @@ export const EditMessageForm = () => { className='str-chat__edit-message-cancel' data-testid='cancel-button' onClick={cancel} + type='button' > {t('Cancel')} diff --git a/src/components/MessageInput/__tests__/ThreadMessageInput.test.js b/src/components/MessageInput/__tests__/ThreadMessageInput.test.js index f31762777..663d892e5 100644 --- a/src/components/MessageInput/__tests__/ThreadMessageInput.test.js +++ b/src/components/MessageInput/__tests__/ThreadMessageInput.test.js @@ -172,6 +172,11 @@ describe('MessageInput in Thread', () => { customClient, }); expect(getDraftSpy).toHaveBeenCalledTimes(1); + await act(() => { + customClient.setMessageComposerSetupFunction(({ composer }) => { + composer.updateConfig({ drafts: { enabled: false } }); + }); + }); }); it('prevents querying if composition is not empty', async () => { const { customChannel, customClient, getDraftSpy } = await setup(); @@ -186,6 +191,11 @@ describe('MessageInput in Thread', () => { customClient, }); expect(getDraftSpy).not.toHaveBeenCalled(); + await act(() => { + customClient.setMessageComposerSetupFunction(({ composer }) => { + composer.updateConfig({ drafts: { enabled: false } }); + }); + }); }); it('prevents querying if not rendered inside a thread', async () => { const { customChannel, customClient, getDraftSpy } = await setup(); @@ -200,6 +210,11 @@ describe('MessageInput in Thread', () => { customClient, }); expect(getDraftSpy).not.toHaveBeenCalled(); + await act(() => { + customClient.setMessageComposerSetupFunction(({ composer }) => { + composer.updateConfig({ drafts: { enabled: false } }); + }); + }); }); it('prevents querying if drafts are disabled (default)', async () => { const { customChannel, customClient, getDraftSpy } = await setup(); diff --git a/src/components/Poll/PollCreationDialog/OptionFieldSet.tsx b/src/components/Poll/PollCreationDialog/OptionFieldSet.tsx index 26e178a28..be0d7d8f7 100644 --- a/src/components/Poll/PollCreationDialog/OptionFieldSet.tsx +++ b/src/components/Poll/PollCreationDialog/OptionFieldSet.tsx @@ -65,7 +65,8 @@ export const OptionFieldSet = () => { }); }} onKeyUp={(event) => { - if (event.key === 'Enter') { + const isFocusedLastOptionField = i === options.length - 1; + if (event.key === 'Enter' && !isFocusedLastOptionField) { const nextInputId = options[i + 1].id; document.getElementById(nextInputId)?.focus(); } diff --git a/src/components/Poll/PollCreationDialog/PollCreationDialogControls.tsx b/src/components/Poll/PollCreationDialog/PollCreationDialogControls.tsx index 00ea0787a..cf8bc9301 100644 --- a/src/components/Poll/PollCreationDialog/PollCreationDialogControls.tsx +++ b/src/components/Poll/PollCreationDialog/PollCreationDialogControls.tsx @@ -22,6 +22,7 @@ export const PollCreationDialogControls = ({ messageComposer.pollComposer.initState(); close(); }} + type='button' > {t('Cancel')}