Drop select-all on unconfirmed VAT ID, keep the refocus

Re-focus still returns attention to the field, but no longer wipes
the customer's input via select() — a stray keystroke while glancing
at the error message shouldn't erase what they typed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Marco
2026-07-23 20:22:11 +00:00
parent 47d03dd61b
commit 0c849c9525
+2 -5
View File
@@ -393,13 +393,10 @@ export function CheckoutContent({
return;
}
setVatIdViesStatus(data.valid ? "valid" : "invalid");
// Re-focus + select the whole value on an unconfirmed VAT ID the
// customer almost certainly needs to retype it (a typo, or the
// wrong id entirely), so the next keystroke should just replace it
// outright rather than requiring a manual select-all first.
// Re-focus (no select-all) on an unconfirmed VAT ID so the customer's
// attention returns to the field without wiping what they typed.
if (!data.valid) {
input.focus();
input.select();
}
} catch {
setVatIdViesStatus("unavailable");