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
+8 -8
View File
@@ -80,7 +80,9 @@ export const ChainSourceCard = () => {
const busy = save.isPending || forget.isPending;
const meta = KINDS[kind];
const submit = async () => {
const submit = async (ev?: React.FormEvent) => {
ev?.preventDefault();
if (!trimmed || !dirty || busy) return;
setError(null);
setHeight(null);
try {
@@ -111,7 +113,8 @@ export const ChainSourceCard = () => {
};
return (
<section className="max-w-2xl rounded-xl border border-border p-4">
// Typing a URL and pressing return is what anyone does; a div full of inputs swallows it silently.
<form onSubmit={submit} className="max-w-2xl rounded-xl border border-border p-4">
<h3 className="mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">Chain source</h3>
<p className="mb-3 text-xs text-muted-foreground">
Where on-chain wallets read balances and history. It sees every address this wallet asks about, so your own node
@@ -144,9 +147,6 @@ export const ChainSourceCard = () => {
<Input
value={url}
onChange={(ev) => setUrl(ev.target.value)}
onKeyDown={(ev) => {
if (ev.key === 'Enter' && trimmed && dirty && !busy) void submit();
}}
placeholder={meta.placeholder}
disabled={isLoading || busy}
className="h-8 font-mono text-xs"
@@ -155,12 +155,12 @@ export const ChainSourceCard = () => {
spellCheck={false}
/>
<div className="flex shrink-0 gap-2">
<Button size="sm" onClick={submit} disabled={!trimmed || !dirty || busy}>
<Button type="submit" size="sm" disabled={!trimmed || !dirty || busy}>
{save.isPending ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" /> : null}
{save.isPending ? 'Connecting…' : 'Save & connect'}
</Button>
{data?.custom && (
<Button size="sm" variant="outline" onClick={reset} disabled={busy} title="Back to the public default">
<Button type="button" size="sm" variant="outline" onClick={reset} disabled={busy} title="Back to the public default">
<RotateCcw className="mr-1.5 h-3.5 w-3.5" />
Reset
</Button>
@@ -188,6 +188,6 @@ export const ChainSourceCard = () => {
: `Using the built-in default (${data?.defaultUrl ?? '—'}), which rate-limits and can see every address you look up.`}{' '}
{meta.hint}
</p>
</section>
</form>
);
};