Skip to content

The open alternative to Salesforce, designed for AI.

Trigger search on mouse up (#12595)

Raphaël Bosi96c2f5477c5c
diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx
index b588f0287f2..bc9d27101ce 100644
--- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx
@@ -37,6 +37,7 @@ export const MainNavigationDrawerFixedItems = () => {
Icon={IconSearch}
onClick={openRecordsSearchPage}
keyboard={['/']}
+ mouseUpNavigation={true}
/>
<NavigationDrawerItem
label={t`Settings`}
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
index 0fb25c3a41a..78169d6bbdd 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
@@ -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}