anastasis-webui: auto-focus

This commit is contained in:
Florian Dold 2021-10-13 19:34:54 +02:00
parent 3aad5e774d
commit 6f4c0a6fb2
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -585,10 +585,10 @@ function AuthMethodSmsSetup(props: AuthMethodSetupProps) {
},
});
};
//const inputRef = useRef<HTMLInputElement>(null);
// useLayoutEffect(() => {
// inputRef.current?.focus();
// }, []);
const inputRef = useRef<HTMLInputElement>(null);
useLayoutEffect(() => {
inputRef.current?.focus();
}, []);
return (
<AnastasisClientFrame hideNav title="Add SMS authentication">
<div>
@ -601,7 +601,7 @@ function AuthMethodSmsSetup(props: AuthMethodSetupProps) {
Mobile number:{" "}
<input
value={mobileNumber}
//ref={inputRef}
ref={inputRef}
style={{ display: "block" }}
autoFocus
onChange={(e) => setMobileNumber((e.target as any).value)}