feat(site): add cmd+enter to submit tasks immediately (#21182)

Implements cmd+enter (Mac) / ctrl+enter (Windows/Linux) keyboard
shortcut for submitting tasks on the tasks page. Regular enter key still
creates new lines as expected.

Fixes #21179

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Ben Potter
2025-12-10 22:00:24 +00:00
committed by GitHub
co-authored by Claude Sonnet 4.5
parent ed3bb76c9b
commit 8e460ca865
@@ -216,7 +216,7 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
},
});
const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
const onSubmit = async (e: React.SyntheticEvent) => {
e.preventDefault();
try {
@@ -231,6 +231,13 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
}
};
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
// Submit form on Cmd+Enter (Mac) or Ctrl+Enter (Windows/Linux)
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
onSubmit(e);
}
};
return (
<form
onSubmit={onSubmit}
@@ -259,6 +266,7 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
onChange={(e) => setPrompt(e.target.value)}
readOnly={isPromptReadOnly}
isSubmitting={createTaskMutation.isPending}
onKeyDown={handleKeyDown}
/>
<div className="flex items-center justify-between pt-2">
<div className="flex items-center gap-1">