Skip to content

Commit

Permalink
fix: dropdown menu doesn't close and remains open (twentyhq#8302)
Browse files Browse the repository at this point in the history
## Description

- Fixes twentyhq#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 <[email protected]>
  • Loading branch information
harshit078 and lucasbordeau authored Nov 8, 2024
1 parent 045f569 commit 0381996
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export enum CurrencyPickerHotkeyScope {
CurrencyPicker = 'currency-picker',
CurrencyPicker = 'currency-picker-dropdown-id',
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 0381996

Please sign in to comment.