diff --git a/packages/vkui/src/hooks/useDateInput.ts b/packages/vkui/src/hooks/useDateInput.ts index 3186b68fb5..f53959fdc4 100644 --- a/packages/vkui/src/hooks/useDateInput.ts +++ b/packages/vkui/src/hooks/useDateInput.ts @@ -39,13 +39,13 @@ export function useDateInput({ const { window } = useDOM(); const removeFocusFromField = React.useCallback(() => { - if (open) { + if (focusedElement !== null) { setFocusedElement(null); closeCalendar(); window!.getSelection()?.removeAllRanges(); setInternalValue(getInternalValue(value)); } - }, [closeCalendar, getInternalValue, open, value, window]); + }, [focusedElement, closeCalendar, getInternalValue, value, window]); const handleClickOutside = React.useCallback( (e: MouseEvent) => {