Skip to content

Commit b50c2f3

Browse files
th-252: * fix weird behaviour of password eye icon toggling on pressing enter (#304)
Co-authored-by: Alina Kupchyk <[email protected]>
1 parent f0a9c78 commit b50c2f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/src/libs/components/input/input.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ const Input = <T extends FieldValues>({
6666
const toggleShowPassword = useCallback(
6767
(event: React.MouseEvent<HTMLElement>): void => {
6868
event.preventDefault();
69-
setIsPasswordShown(!isPasswordShown);
69+
setIsPasswordShown((old) => !old);
7070
},
71-
[isPasswordShown],
71+
[],
7272
);
7373

7474
const clearError = useCallback(() => {
@@ -116,6 +116,7 @@ const Input = <T extends FieldValues>({
116116
styles.passwordEye,
117117
isPasswordShown && styles.passwordEyeLight,
118118
)}
119+
type="button"
119120
onClick={toggleShowPassword}
120121
tabIndex={-1}
121122
>

0 commit comments

Comments
 (0)