Trigger search on mouse up (#12595)
This fixes one of the issues in https://github.com/twentyhq/core-team-issues/issues/1093. See discussion in https://github.com/twentyhq/twenty/pull/12577 https://github.com/user-attachments/assets/f02a8b06-6246-4c9e-b1f2-8d8ce5091cdc
This commit is contained in:
@ -37,6 +37,7 @@ export const MainNavigationDrawerFixedItems = () => {
|
||||
Icon={IconSearch}
|
||||
onClick={openRecordsSearchPage}
|
||||
keyboard={['/']}
|
||||
mouseUpNavigation={true}
|
||||
/>
|
||||
<NavigationDrawerItem
|
||||
label={t`Settings`}
|
||||
|
||||
@ -39,6 +39,7 @@ export type NavigationDrawerItemProps = {
|
||||
isDragging?: boolean;
|
||||
isRightOptionsDropdownOpen?: boolean;
|
||||
triggerEvent?: TriggerEventType;
|
||||
mouseUpNavigation?: boolean;
|
||||
};
|
||||
|
||||
type StyledItemProps = Pick<
|
||||
@ -253,6 +254,7 @@ export const NavigationDrawerItem = ({
|
||||
isDragging,
|
||||
isRightOptionsDropdownOpen,
|
||||
triggerEvent,
|
||||
mouseUpNavigation = false,
|
||||
}: NavigationDrawerItemProps) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useIsMobile();
|
||||
@ -268,20 +270,24 @@ export const NavigationDrawerItem = ({
|
||||
}
|
||||
};
|
||||
|
||||
const { onClick: handleClick, onMouseDown: handleMouseDown } =
|
||||
useMouseDownNavigation({
|
||||
to,
|
||||
onClick,
|
||||
onBeforeNavigation: handleMobileNavigation,
|
||||
triggerEvent,
|
||||
});
|
||||
const {
|
||||
onClick: handleMouseDownNavigationClickClick,
|
||||
onMouseDown: handleMouseDown,
|
||||
} = useMouseDownNavigation({
|
||||
to,
|
||||
onClick,
|
||||
onBeforeNavigation: handleMobileNavigation,
|
||||
triggerEvent,
|
||||
});
|
||||
|
||||
return (
|
||||
<StyledNavigationDrawerItemContainer>
|
||||
<StyledItem
|
||||
className={`navigation-drawer-item ${className || ''}`}
|
||||
onClick={handleClick}
|
||||
onMouseDown={handleMouseDown}
|
||||
onClick={
|
||||
mouseUpNavigation ? onClick : handleMouseDownNavigationClickClick
|
||||
}
|
||||
onMouseDown={mouseUpNavigation ? undefined : handleMouseDown}
|
||||
active={active}
|
||||
aria-selected={active}
|
||||
danger={danger}
|
||||
|
||||
Reference in New Issue
Block a user