Raphaël Bosi
2025-06-13 14:50:30 +02:00
committed by GitHub
parent 194549b77e
commit 96c2f5477c
2 changed files with 16 additions and 9 deletions

View File

@ -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`}

View File

@ -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}