From 2095cb88c25ed5a048db6a7723e4768c3ea83bd7 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 28 Oct 2025 06:55:03 -0700 Subject: [PATCH] Fix entering encryption key https://feedback.yaak.app/p/encryption-feature-error --- src-web/components/core/PlainInput.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src-web/components/core/PlainInput.tsx b/src-web/components/core/PlainInput.tsx index 696b7061..9d8c4bce 100644 --- a/src-web/components/core/PlainInput.tsx +++ b/src-web/components/core/PlainInput.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import type { FocusEvent, HTMLAttributes } from 'react'; +import type { FocusEvent, HTMLAttributes, ReactNode } from 'react'; import { forwardRef, useCallback, @@ -21,6 +21,7 @@ export type PlainInputProps = Omit void }, PlainInputProps>(function PlainInput( @@ -37,6 +38,7 @@ export const PlainInput = forwardRef<{ focus: () => void }, PlainInputProps>(fun label, labelClassName, labelPosition = 'top', + labelRightSlot, leftSlot, name, onBlur, @@ -91,10 +93,11 @@ export const PlainInput = forwardRef<{ focus: () => void }, PlainInputProps>(fun // Force input to update when receiving change and not in focus useLayoutEffect(() => { - if (!focused) { + const isFocused = document.activeElement === inputRef.current; + if (defaultValue != null && !isFocused) { regenerateFocusedUpdateKey(); } - }, [focused, regenerateFocusedUpdateKey, defaultValue]); + }, [regenerateFocusedUpdateKey, defaultValue]); const id = `input-${name}`; const commonClassName = classNames( @@ -136,6 +139,7 @@ export const PlainInput = forwardRef<{ focus: () => void }, PlainInputProps>(fun visuallyHidden={hideLabel} required={required} help={help} + rightSlot={labelRightSlot} > {label}