wrap chain source, rescan and wallet-rename fields in real forms

three input sites lived in a div instead of a form, so pressing enter did
nothing and the button was the only way in. chain source url, rescan search
depth, and the inline wallet-rename field all get a <form onSubmit>, with
every non-submit button in each marked type="button" (the rescan card's
reset button was previously untyped, which would have submitted the form
once wrapped).

CoinsView.tsx has no text inputs (checkbox + buttons only) and
SeedPhraseInput.tsx deliberately hijacks enter to advance between word boxes
rather than submit, so both are left alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-19 10:42:35 +00:00
co-authored by Claude Opus 5
parent 00ea1acf75
commit 302d8b48c7
3 changed files with 23 additions and 17 deletions
+6 -6
View File
@@ -206,7 +206,8 @@ const WalletNameField = ({ wallet, onSave, isPending }: WalletNameFieldProps) =>
const trimmed = draft.trim();
const dirty = trimmed !== wallet.name;
const commit = async () => {
const commit = async (ev?: React.FormEvent) => {
ev?.preventDefault();
if (!trimmed || !dirty) {
setDraft(wallet.name);
setEditing(false);
@@ -242,7 +243,7 @@ const WalletNameField = ({ wallet, onSave, isPending }: WalletNameFieldProps) =>
}
return (
<div className="flex min-w-0 items-center gap-1.5">
<form onSubmit={commit} className="flex min-w-0 items-center gap-1.5">
<Input
ref={inputRef}
autoFocus
@@ -251,7 +252,6 @@ const WalletNameField = ({ wallet, onSave, isPending }: WalletNameFieldProps) =>
disabled={isPending}
onChange={(ev) => setDraft(ev.target.value)}
onKeyDown={(ev) => {
if (ev.key === 'Enter') void commit();
if (ev.key === 'Escape') cancel();
}}
className="h-7 max-w-56 text-sm font-semibold"
@@ -259,13 +259,13 @@ const WalletNameField = ({ wallet, onSave, isPending }: WalletNameFieldProps) =>
autoComplete="off"
spellCheck={false}
/>
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={commit} disabled={isPending || !trimmed}>
<Button type="submit" size="icon" variant="ghost" className="h-7 w-7" disabled={isPending || !trimmed}>
<Check className="h-3.5 w-3.5" />
</Button>
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={cancel} disabled={isPending}>
<Button type="button" size="icon" variant="ghost" className="h-7 w-7" onClick={cancel} disabled={isPending}>
<X className="h-3.5 w-3.5" />
</Button>
</div>
</form>
);
};