From a85517de99a066f9f8ff7f85665cd8849942ed9f Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 7 May 2024 14:02:48 +0530 Subject: [PATCH] [WEB-1098] chore: dropdowns enhancement (#4375) --- packages/ui/src/dropdowns/custom-search-select.tsx | 9 +++++++-- packages/ui/src/dropdowns/custom-select.tsx | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/dropdowns/custom-search-select.tsx b/packages/ui/src/dropdowns/custom-search-select.tsx index d1778e31a..275506ad7 100644 --- a/packages/ui/src/dropdowns/custom-search-select.tsx +++ b/packages/ui/src/dropdowns/custom-search-select.tsx @@ -66,6 +66,11 @@ export const CustomSearchSelect = (props: ICustomSearchSelectProps) => { const handleKeyDown = useDropdownKeyDown(openDropdown, closeDropdown, isOpen); useOutsideClickDetector(dropdownRef, closeDropdown); + const toggleDropdown = () => { + if (isOpen) closeDropdown(); + else openDropdown(); + }; + return ( { ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80" } ${customButtonClassName}`} - onClick={openDropdown} + onClick={toggleDropdown} > {customButton} @@ -107,7 +112,7 @@ export const CustomSearchSelect = (props: ICustomSearchSelectProps) => { ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80" } ${buttonClassName}`} - onClick={openDropdown} + onClick={toggleDropdown} > {label} {!noChevron && !disabled &&