diff --git a/src/components/views/rooms/BasicMessageComposer.tsx b/src/components/views/rooms/BasicMessageComposer.tsx index 89709c796c..8f0bd168ad 100644 --- a/src/components/views/rooms/BasicMessageComposer.tsx +++ b/src/components/views/rooms/BasicMessageComposer.tsx @@ -554,8 +554,6 @@ export default class BasicMessageEditor extends React.Component autoComplete.onEscape(event); handled = true; break; - default: - return; // don't preventDefault on anything else } } else if (autocompleteAction === KeyBindingAction.ForceCompleteAutocomplete && !this.state.showVisualBell) { // there is no current autocomplete window, try to open it diff --git a/test/components/views/rooms/BasicMessageComposer-test.tsx b/test/components/views/rooms/BasicMessageComposer-test.tsx index 0d5faa3550..4215ce6e64 100644 --- a/test/components/views/rooms/BasicMessageComposer-test.tsx +++ b/test/components/views/rooms/BasicMessageComposer-test.tsx @@ -82,6 +82,18 @@ describe("BasicMessageComposer", () => { expect(transformedText).toBe(after + " "); } }); + + it("should not mangle shift-enter when the autocomplete is open", async () => { + const model = new EditorModel([], pc, renderer); + render(); + + const input = screen.getByRole("textbox"); + + await userEvent.type(input, "/plain foobar"); + await userEvent.type(input, "{Shift>}{Enter}{/Shift}"); + const transformedText = model.parts.map((part) => part.text).join(""); + expect(transformedText).toBe("/plain foobar\n"); + }); }); function generateMockDataTransferForString(string: string): DataTransfer {