diff --git a/src/containers/internal/views/carriers/form.tsx b/src/containers/internal/views/carriers/form.tsx index 3ec9142..3333efe 100644 --- a/src/containers/internal/views/carriers/form.tsx +++ b/src/containers/internal/views/carriers/form.tsx @@ -906,26 +906,22 @@ export const CarrierForm = ({ const invalidField = e.target as unknown as HTMLInputElement; const fieldName = invalidField.name || invalidField.id; - // Map field names to tabs - if (fieldName === "carrier_name") { - setActiveTab("general"); - } else if (fieldName?.includes("inbound_auth_")) { - setActiveTab("inbound"); - } else if ( - fieldName?.includes("sip_username") || - fieldName?.includes("sip_password") || - fieldName?.includes("sip_realm") || - fieldName?.includes("from_user") || - fieldName?.includes("from_domain") - ) { - setActiveTab("outbound"); // Changed from "registration" to "outbound" - } else if (fieldName?.includes("sip_")) { - setActiveTab("sip"); + // Simple mapping: which tab should this field be on? + let targetTab = "general"; + + if (fieldName?.includes("inbound_auth_")) { + targetTab = "inbound"; + } else if (fieldName?.includes("sip_") || fieldName?.includes("from_")) { + targetTab = "outbound"; } else if (fieldName?.includes("smpp_")) { - setActiveTab("smpp"); + targetTab = "smpp"; } - // Allow the default browser validation message to show + // If we're not on the right tab, switch to it + if (activeTab !== targetTab) { + e.preventDefault(); // Stop the "not focusable" error + setActiveTab(targetTab); + } }; return ( @@ -1401,122 +1397,202 @@ export const CarrierForm = ({
- + )}
-