fix(ui): submit dialog forms on Enter key (#989)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
d52e4eae96
commit
47de56c72e
@@ -1090,6 +1090,12 @@ export default function TaskPage(): React.JSX.Element {
|
||||
autoFocus
|
||||
value={newIssueTitle}
|
||||
onChange={(e) => setNewIssueTitle(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
void handleCreateNewIssue()
|
||||
}
|
||||
}}
|
||||
placeholder="Short summary"
|
||||
disabled={newIssueSubmitting}
|
||||
/>
|
||||
|
||||
@@ -41,7 +41,13 @@ export function SshTargetForm({
|
||||
onCancel
|
||||
}: SshTargetFormProps): React.JSX.Element {
|
||||
return (
|
||||
<div className="space-y-4 rounded-lg border border-border/50 bg-card/40 p-4">
|
||||
<form
|
||||
className="space-y-4 rounded-lg border border-border/50 bg-card/40 p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
onSave()
|
||||
}}
|
||||
>
|
||||
<p className="text-sm font-medium">{editingId ? 'Edit SSH Target' : 'New SSH Target'}</p>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
@@ -119,13 +125,13 @@ export function SshTargetForm({
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Button size="sm" onClick={onSave}>
|
||||
<Button type="submit" size="sm">
|
||||
{editingId ? 'Save Changes' : 'Add Target'}
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={onCancel}>
|
||||
<Button type="button" variant="ghost" size="sm" onClick={onCancel}>
|
||||
Cancel
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -242,6 +242,14 @@ export function RemoteStep({
|
||||
<Input
|
||||
value={remotePath}
|
||||
onChange={(e) => onRemotePathChange(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
if (selectedTargetId && remotePath.trim() && !isAddingRemote) {
|
||||
onAdd()
|
||||
}
|
||||
}
|
||||
}}
|
||||
placeholder="/home/user/project"
|
||||
className="h-8 text-xs flex-1"
|
||||
disabled={isAddingRemote}
|
||||
@@ -297,6 +305,15 @@ export function CloneStep({
|
||||
onPickDestination,
|
||||
onClone
|
||||
}: CloneStepProps): React.JSX.Element {
|
||||
const canClone = !!cloneUrl.trim() && !!cloneDestination.trim() && !isCloning
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>): void => {
|
||||
if (e.key === 'Enter' && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
if (canClone) {
|
||||
onClone()
|
||||
}
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<DialogHeader>
|
||||
@@ -310,6 +327,7 @@ export function CloneStep({
|
||||
<Input
|
||||
value={cloneUrl}
|
||||
onChange={(e) => onUrlChange(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="https://github.com/user/repo.git"
|
||||
className="h-8 text-xs"
|
||||
disabled={isCloning}
|
||||
@@ -323,6 +341,7 @@ export function CloneStep({
|
||||
<Input
|
||||
value={cloneDestination}
|
||||
onChange={(e) => onDestChange(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="/path/to/destination"
|
||||
className="h-8 text-xs flex-1"
|
||||
disabled={isCloning}
|
||||
|
||||
Reference in New Issue
Block a user