fix: dropdown menu doesn't close and remains open (#8302)

## Description

- Fixes #8285 
- Added fix for both Currency and PhoneCountry dropdown

## Changes



https://github.com/user-attachments/assets/cbf85100-7791-40da-a676-2c87c6a32976

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Harshit Singh 2024-11-08 21:43:15 +05:30 committed by GitHub
parent 045f569d62
commit 0381996fb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View File

@ -35,7 +35,12 @@ export const MultiItemFieldMenuItem = <T,>({
const { isDropdownOpen, closeDropdown } = useDropdown(dropdownId);
const handleMouseEnter = () => setIsHovered(true);
const handleMouseLeave = () => setIsHovered(false);
const handleMouseLeave = () => {
setIsHovered(false);
if (isDropdownOpen) {
closeDropdown();
}
};
const handleDeleteClick = () => {
closeDropdown();

View File

@ -1,3 +1,3 @@
export enum CurrencyPickerHotkeyScope {
CurrencyPicker = 'currency-picker',
CurrencyPicker = 'currency-picker-dropdown-id',
}

View File

@ -70,7 +70,7 @@ export const PhoneCountryPickerDropdownButton = ({
const [selectedCountry, setSelectedCountry] = useState<Country>();
const { isDropdownOpen, closeDropdown } = useDropdown(
CountryPickerHotkeyScope.CountryPicker,
'country-picker-dropdown-id',
);
const handleChange = (countryCode: string) => {