diff --git a/apps/meteor/client/sidebar/search/SearchList.tsx b/apps/meteor/client/sidebar/search/SearchList.tsx index 52f2dd7988e48..32868b48cb060 100644 --- a/apps/meteor/client/sidebar/search/SearchList.tsx +++ b/apps/meteor/client/sidebar/search/SearchList.tsx @@ -25,11 +25,13 @@ import React, { Dispatch, FormEventHandler, Ref, + MouseEventHandler, } from 'react'; import { Virtuoso, VirtuosoHandle } from 'react-virtuoso'; import tinykeys from 'tinykeys'; import { useAvatarTemplate } from '../hooks/useAvatarTemplate'; +import { usePreventDefault } from '../hooks/usePreventDefault'; import { useTemplateByViewMode } from '../hooks/useTemplateByViewMode'; import Row from './Row'; import ScrollerWithCustomProps from './ScrollerWithCustomProps'; @@ -239,6 +241,8 @@ const SearchList = forwardRef(function SearchList({ onClose }: SearchListProps, } }); + usePreventDefault(boxRef); + useEffect(() => { resetCursor(); }); @@ -286,6 +290,13 @@ const SearchList = forwardRef(function SearchList({ onClose }: SearchListProps, }; }, [cursorRef, changeSelection, items.length, onClose, resetCursor, setFilterValue]); + const handleClick: MouseEventHandler = (e): void => { + if (e.target instanceof Element && [e.target.tagName, e.target.parentElement?.tagName].includes('BUTTON')) { + return; + } + return onClose(); + }; + return (