From ad5bf1d015d0c9d1b6affd52ee845ac1b24997b8 Mon Sep 17 00:00:00 2001 From: "Wiktor A. Falkowski" Date: Wed, 21 Oct 2026 22:45:08 +0000 Subject: [PATCH] fix(auth): prevent register modal inputs from losing focus on typing --- src/App.jsx | 123 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 23 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 5508e82..9a924c7 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -982,6 +982,40 @@ function ForgotPasswordModal({ onClose, colors }) { ); } +// Top-level input field to prevent unmounting and focus loss on re-renders +function RegisterInputField({ + label, + name, + type = "text", + placeholder, + required = false, + value = '', + onChange, + disabled = false, + colors, + ...props +}) { + return ( +
+ + +
+ ); +} + // Register Modal Component - UPDATED to match Dashboard style function RegisterModal({ onClose, @@ -1010,6 +1044,11 @@ function RegisterModal({ [countryOptions], ); + const handleInputChange = useCallback((e) => { + const { name, value } = e.target; + setFormData(prev => ({ ...prev, [name]: value })); + }, []); + const detectUserLocation = useCallback(async () => { setDetectingLocation(true); try { @@ -1058,23 +1097,6 @@ function RegisterModal({ }); }; - const InputField = ({ label, name, type = "text", placeholder, required = false, ...props }) => ( -
- - setFormData(prev => ({ ...prev, [name]: e.target.value }))} - className="w-full rounded-2xl px-5 py-3.5 text-sm font-bold focus:outline-none transition-all duration-300 border bg-black/40 focus:border-primary/50 focus:ring-4 focus:ring-primary/10" - style={{ borderColor: colors.brightBlack, color: colors.brightWhite }} - placeholder={placeholder} - required={required} - disabled={isLoading} - {...props} - /> -
- ); - return (
- - - - + + + +
@@ -1135,8 +1192,28 @@ function RegisterModal({
- - + +