From 948354e9c3f4a85b78697790364f3ac6b1ae4b4b Mon Sep 17 00:00:00 2001 From: Guilherme Rodz Date: Fri, 1 Nov 2024 16:12:27 -0300 Subject: [PATCH] chore(input): remove re-focus feature for password manager badges --- packages/input-otp/src/use-pwm-badge.tsx | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/packages/input-otp/src/use-pwm-badge.tsx b/packages/input-otp/src/use-pwm-badge.tsx index f9cdd34..01d7b40 100644 --- a/packages/input-otp/src/use-pwm-badge.tsx +++ b/packages/input-otp/src/use-pwm-badge.tsx @@ -23,15 +23,6 @@ export function usePasswordManagerBadge({ pushPasswordManagerStrategy: OTPInputProps['pushPasswordManagerStrategy'] isFocused: boolean }) { - // Metadata for instant updates (not React state) - const pwmMetadata = React.useRef<{ - done: boolean - refocused: boolean - }>({ - done: false, - refocused: false, - }) - /** Password managers have a badge * and I'll use this state to push them * outside the input */ @@ -98,19 +89,6 @@ export function usePasswordManagerBadge({ setHasPWMBadge(true) setDone(true) - - // For specific password managers, - // the input has to be re-focused - // to trigger a re-position of the badge. - if (!pwmMetadata.current.refocused && document.activeElement === input) { - const sel = [input.selectionStart, input.selectionEnd] - input.blur() - input.focus() - // Recover the previous selection - input.setSelectionRange(sel[0], sel[1]) - - pwmMetadata.current.refocused = true - } }, [containerRef, inputRef, done, pushPasswordManagerStrategy]) React.useEffect(() => {