From 0eca289cc1e32ea297877b71610c9bdad7794aa0 Mon Sep 17 00:00:00 2001 From: Souptik Datta Date: Thu, 16 May 2024 14:11:19 +0530 Subject: [PATCH] Add inline comments Signed-off-by: Souptik Datta --- components/content-search/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/content-search/index.tsx b/components/content-search/index.tsx index a8953a47..27a89001 100644 --- a/components/content-search/index.tsx +++ b/components/content-search/index.tsx @@ -420,9 +420,10 @@ const ContentSearch: React.FC = ({ const hasSearchResults = searchResults && !!searchResults.length; const hasInitialResults = fetchInitialResults && isFocused; + // Add event listener to close search results when clicking outside of the search container. useEffect(() => { document.addEventListener('mouseup', (e: MouseEvent) => { - // Bail if search control or search results container is clicked. + // Bail if anywhere inside search container is clicked. if ( searchContainer.current?.contains(e.target as Node) ) {