fix: Update company picker keyboard navigation (#1628)
* fix: scroll * fix: use ref * fix: new changes * fix: remove ref * fix: state * chore: clean up * Include Empty option * Include Empty option * Include Empty option * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -2,10 +2,7 @@ import { useRef } from 'react';
|
||||
|
||||
import { DropdownMenuSearchInput } from '@/ui/dropdown/components/DropdownMenuSearchInput';
|
||||
import { StyledDropdownMenu } from '@/ui/dropdown/components/StyledDropdownMenu';
|
||||
import { StyledDropdownMenuItemsContainer } from '@/ui/dropdown/components/StyledDropdownMenuItemsContainer';
|
||||
import { StyledDropdownMenuSeparator } from '@/ui/dropdown/components/StyledDropdownMenuSeparator';
|
||||
import { IconPlus } from '@/ui/icon';
|
||||
import { MenuItem } from '@/ui/menu-item/components/MenuItem';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
@ -59,6 +56,7 @@ export const SingleEntitySelect = <
|
||||
onCancel?.();
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<StyledDropdownMenu
|
||||
disableBlur={disableBackgroundBlur}
|
||||
@ -71,15 +69,12 @@ export const SingleEntitySelect = <
|
||||
autoFocus
|
||||
/>
|
||||
<StyledDropdownMenuSeparator />
|
||||
<SingleEntitySelectBase {...props} onCancel={onCancel} />
|
||||
{showCreateButton && (
|
||||
<>
|
||||
<StyledDropdownMenuItemsContainer hasMaxHeight>
|
||||
<MenuItem onClick={onCreate} LeftIcon={IconPlus} text="Add New" />
|
||||
</StyledDropdownMenuItemsContainer>
|
||||
<StyledDropdownMenuSeparator />
|
||||
</>
|
||||
)}
|
||||
<SingleEntitySelectBase
|
||||
{...props}
|
||||
onCancel={onCancel}
|
||||
onCreate={onCreate}
|
||||
showCreateButton={showCreateButton}
|
||||
/>
|
||||
</StyledDropdownMenu>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user