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}
|
Icon={IconSearch}
|
||||||
onClick={openRecordsSearchPage}
|
onClick={openRecordsSearchPage}
|
||||||
keyboard={['/']}
|
keyboard={['/']}
|
||||||
|
mouseUpNavigation={true}
|
||||||
/>
|
/>
|
||||||
<NavigationDrawerItem
|
<NavigationDrawerItem
|
||||||
label={t`Settings`}
|
label={t`Settings`}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ export type NavigationDrawerItemProps = {
|
|||||||
isDragging?: boolean;
|
isDragging?: boolean;
|
||||||
isRightOptionsDropdownOpen?: boolean;
|
isRightOptionsDropdownOpen?: boolean;
|
||||||
triggerEvent?: TriggerEventType;
|
triggerEvent?: TriggerEventType;
|
||||||
|
mouseUpNavigation?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyledItemProps = Pick<
|
type StyledItemProps = Pick<
|
||||||
@ -253,6 +254,7 @@ export const NavigationDrawerItem = ({
|
|||||||
isDragging,
|
isDragging,
|
||||||
isRightOptionsDropdownOpen,
|
isRightOptionsDropdownOpen,
|
||||||
triggerEvent,
|
triggerEvent,
|
||||||
|
mouseUpNavigation = false,
|
||||||
}: NavigationDrawerItemProps) => {
|
}: NavigationDrawerItemProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
@ -268,20 +270,24 @@ export const NavigationDrawerItem = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const { onClick: handleClick, onMouseDown: handleMouseDown } =
|
const {
|
||||||
useMouseDownNavigation({
|
onClick: handleMouseDownNavigationClickClick,
|
||||||
to,
|
onMouseDown: handleMouseDown,
|
||||||
onClick,
|
} = useMouseDownNavigation({
|
||||||
onBeforeNavigation: handleMobileNavigation,
|
to,
|
||||||
triggerEvent,
|
onClick,
|
||||||
});
|
onBeforeNavigation: handleMobileNavigation,
|
||||||
|
triggerEvent,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledNavigationDrawerItemContainer>
|
<StyledNavigationDrawerItemContainer>
|
||||||
<StyledItem
|
<StyledItem
|
||||||
className={`navigation-drawer-item ${className || ''}`}
|
className={`navigation-drawer-item ${className || ''}`}
|
||||||
onClick={handleClick}
|
onClick={
|
||||||
onMouseDown={handleMouseDown}
|
mouseUpNavigation ? onClick : handleMouseDownNavigationClickClick
|
||||||
|
}
|
||||||
|
onMouseDown={mouseUpNavigation ? undefined : handleMouseDown}
|
||||||
active={active}
|
active={active}
|
||||||
aria-selected={active}
|
aria-selected={active}
|
||||||
danger={danger}
|
danger={danger}
|
||||||
|
|||||||
Reference in New Issue
Block a user