From 08b062e40d2f4e02632657f997e3306f14e2ba58 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 24 Dec 2021 01:26:12 +0100 Subject: [PATCH] Forward Modal: Fix selecting chat from keyboard --- src/components/common/ChatOrUserPicker.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/common/ChatOrUserPicker.tsx b/src/components/common/ChatOrUserPicker.tsx index c77ff427..d842ce7e 100644 --- a/src/components/common/ChatOrUserPicker.tsx +++ b/src/components/common/ChatOrUserPicker.tsx @@ -48,7 +48,10 @@ const ChatOrUserPicker: FC = ({ const lang = useLang(); const [viewportIds, getMore] = useInfiniteScroll(loadMore, chatOrUserIds, Boolean(filter)); - useInputFocusOnOpen(filterRef, isOpen, () => { onFilterChange(''); }); + const resetFilter = useCallback(() => { + onFilterChange(''); + }, [onFilterChange]); + useInputFocusOnOpen(filterRef, isOpen, resetFilter); // eslint-disable-next-line no-null/no-null const containerRef = useRef(null);