Skip to content

Commit

Permalink
general: fix TooltipButton to stay open on desktop (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz authored Jan 9, 2025
1 parent 0655573 commit eadd044
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/components/utils/TooltipButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,32 @@ export const TooltipButton = ({ tooltip, onClick, color }: Props) => {

useClickAwayListener(tooltipRef, hide, isMobile);

return (
const content = (
<StyledIconButton onClick={handleClick}>
<InfoOutlinedIcon fontSize="small" color={color} />
</StyledIconButton>
);

// There is a bug in MUI, passing `open={undefined}` prop to Tooltip makes it uninteractive TODO check again eg 6/2025, or report
return isMobile ? (
<Tooltip
arrow
title={tooltip}
placement="top"
open={mobileTooltipShown}
ref={tooltipRef}
>
{content}
</Tooltip>
) : (
<Tooltip
arrow
title={tooltip}
placement="top"
open={isMobile ? mobileTooltipShown : undefined}
//open={isMobile ? mobileTooltipShown : undefined} -- broken, see above
ref={tooltipRef}
>
<StyledIconButton onClick={handleClick}>
<InfoOutlinedIcon fontSize="small" color={color} />
</StyledIconButton>
{content}
</Tooltip>
);
};

0 comments on commit eadd044

Please sign in to comment.