From a0dc97487ba296abdc784f26e3acec3119f46194 Mon Sep 17 00:00:00 2001 From: Hoan HL Date: Mon, 27 Oct 2025 09:27:58 +0700 Subject: [PATCH] fixed reg trunk validation cannot move tab and focus to missing fields --- src/containers/internal/views/carriers/form.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/containers/internal/views/carriers/form.tsx b/src/containers/internal/views/carriers/form.tsx index 3333efe..f933f28 100644 --- a/src/containers/internal/views/carriers/form.tsx +++ b/src/containers/internal/views/carriers/form.tsx @@ -921,6 +921,17 @@ export const CarrierForm = ({ if (activeTab !== targetTab) { e.preventDefault(); // Stop the "not focusable" error setActiveTab(targetTab); + + setTimeout(() => { + const field = + document.getElementById(fieldName) || + document.querySelector(`[name="${fieldName}"]`); + if (field && field instanceof HTMLInputElement) { + field.focus(); + field.scrollIntoView({ behavior: "smooth", block: "center" }); + field.reportValidity(); + } + }, 100); } };