fix: show validation error on incomplete login submit
Address Greptile review feedback: - Show "Please fill in all required fields." instead of silently returning when form is submitted with missing fields - Remove pointer-events-none so keyboard users can reach the button and receive the same validation feedback Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
8a201022c0
commit
88df0fecb0
1 changed files with 6 additions and 2 deletions
|
|
@ -91,7 +91,11 @@ export function AuthPage() {
|
|||
className="mt-6 space-y-4"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
if (!canSubmit || mutation.isPending) return;
|
||||
if (mutation.isPending) return;
|
||||
if (!canSubmit) {
|
||||
setError("Please fill in all required fields.");
|
||||
return;
|
||||
}
|
||||
mutation.mutate();
|
||||
}}
|
||||
>
|
||||
|
|
@ -133,7 +137,7 @@ export function AuthPage() {
|
|||
type="submit"
|
||||
disabled={mutation.isPending}
|
||||
aria-disabled={!canSubmit || mutation.isPending}
|
||||
className={`w-full ${!canSubmit ? "opacity-50 pointer-events-none" : ""}`}
|
||||
className={`w-full ${!canSubmit && !mutation.isPending ? "opacity-50" : ""}`}
|
||||
>
|
||||
{mutation.isPending
|
||||
? "Working…"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue