From 90cdeda142058174e97ea0f1ad51990dc2ee3df6 Mon Sep 17 00:00:00 2001
From: Kawa
Date: Wed, 1 Apr 2026 13:30:39 +0200
Subject: [PATCH] feat(11-02): auto-scroll to first errored field on validation
failure
- BackendSelectionStep: add onInvalidSubmit scrolling to remote-name input
- BackendSelectionStep: pass onInvalidSubmit to form onSubmit and handleCardClick
- RemoteConfigStep: add FieldErrors import from react-hook-form
- RemoteConfigStep: add onInvalidSubmit scrolling to first errored field by key
- RemoteConfigStep: pass onInvalidSubmit to form onSubmit
---
src/components/wizard/BackendSelectionStep.tsx | 9 +++++++--
src/components/wizard/RemoteConfigStep.tsx | 11 +++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/components/wizard/BackendSelectionStep.tsx b/src/components/wizard/BackendSelectionStep.tsx
index df7d0f5..af151a5 100644
--- a/src/components/wizard/BackendSelectionStep.tsx
+++ b/src/components/wizard/BackendSelectionStep.tsx
@@ -50,9 +50,14 @@ export function BackendSelectionStep() {
dispatch({ type: 'SET_STEP', payload: 1 });
}
+ function onInvalidSubmit() {
+ // Only one validatable field in this step: remote-name
+ document.getElementById('remote-name')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ }
+
function handleCardClick(backendType: BackendType) {
pendingBackend.current = backendType;
- void handleSubmit(onValidSubmit)();
+ void handleSubmit(onValidSubmit, onInvalidSubmit)();
}
return (
@@ -62,7 +67,7 @@ export function BackendSelectionStep() {
Name your remote and pick the cloud storage provider you want to connect to.
Your choice determines which credentials are required in the next step.
-