From 38278e95483b4efa7729fde3387c71e09fab41a2 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 16 Apr 2021 14:48:26 +0300 Subject: [PATCH] Auth Password: Select wrong password for easy editing (#1011) --- src/components/common/PasswordForm.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/common/PasswordForm.tsx b/src/components/common/PasswordForm.tsx index 76a63a0a..3e4e3b21 100644 --- a/src/components/common/PasswordForm.tsx +++ b/src/components/common/PasswordForm.tsx @@ -50,6 +50,15 @@ const PasswordForm: FC = ({ } }, []); + useEffect(() => { + if (error) { + requestAnimationFrame(() => { + inputRef.current!.focus(); + inputRef.current!.select(); + }); + } + }, [error]); + function onPasswordChange(e: ChangeEvent) { if (error) { clearError();