Skip to content

Commit b0dd02b

Browse files
committed
fix: improve IME compatibility by changing form submission to Ctrl/Cmd+Enter
- Remove automatic form submission on Enter key to prevent conflicts with IME - Add Ctrl+Enter (Windows/Linux) and Cmd+Enter (Mac) as submission shortcuts - Preserve native textarea behavior for line breaks with Shift+Enter - Fix issue where Japanese/Chinese/Korean input confirmation triggered form submission
1 parent fddf107 commit b0dd02b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

frontend/src/components/InputForm.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ export const InputForm: React.FC<InputFormProps> = ({
3535
setInternalInputValue("");
3636
};
3737

38-
const handleInternalKeyDown = (
39-
e: React.KeyboardEvent<HTMLTextAreaElement>
40-
) => {
41-
if (e.key === "Enter" && !e.shiftKey) {
38+
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
39+
// Submit with Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac)
40+
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
4241
e.preventDefault();
4342
handleInternalSubmit();
4443
}
@@ -59,9 +58,9 @@ export const InputForm: React.FC<InputFormProps> = ({
5958
<Textarea
6059
value={internalInputValue}
6160
onChange={(e) => setInternalInputValue(e.target.value)}
62-
onKeyDown={handleInternalKeyDown}
61+
onKeyDown={handleKeyDown}
6362
placeholder="Who won the Euro 2024 and scored the most goals?"
64-
className={`w-full text-neutral-100 placeholder-neutral-500 resize-none border-0 focus:outline-none focus:ring-0 outline-none focus-visible:ring-0 shadow-none
63+
className={`w-full text-neutral-100 placeholder-neutral-500 resize-none border-0 focus:outline-none focus:ring-0 outline-none focus-visible:ring-0 shadow-none
6564
md:text-base min-h-[56px] max-h-[200px]`}
6665
rows={1}
6766
/>

0 commit comments

Comments
 (0)