Skip to content

Commit 3214a7e

Browse files
authored
Merge pull request #17 from kahirokunn/fix/ime-input-form-submission
Fix IME input issues by implementing Ctrl/Cmd+Enter submission
2 parents d3fd999 + b0dd02b commit 3214a7e

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)