Skip to content

Commit

Permalink
fix(datatrak): RN-1450: Fix mobile tooltips (#5971)
Browse files Browse the repository at this point in the history
* Update Tooltip.tsx

* set delay on BaseTooltip

---------

Co-authored-by: Andrew <[email protected]>
  • Loading branch information
tcaiger and avaek authored Nov 7, 2024
1 parent f85052f commit 04ed541
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const CopySurveyUrlButton = () => {
}
arrow
enterDelay={500}
enterTouchDelay={500}
>
<Button aria-label="copy url to clipboard" onClick={copyPageUrl}>
<CopyIcon />
Expand Down
7 changes: 5 additions & 2 deletions packages/ui-components/src/components/Inputs/InputLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ const TooltipWrapper = styled.span`
height: 100%;
width: 100%;
}
&:hover,
&:focus {
svg {
fill: ${props => props.theme.palette.primary.main};
${({ theme }) => theme.breakpoints.up('md')} {
svg {
fill: ${props => props.theme.palette.primary.main};
}
}
}
`;
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-components/src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ const TOOLTIP_COLOR = '#002d47';

// For placement options @see https://material-ui.com/api/tooltip
export const Tooltip = styled(
({ className, placement = 'top', enterDelay, ...props }: TooltipProps) => (
({ className, placement = 'top', enterDelay, enterTouchDelay = 10, ...props }: TooltipProps) => (
<MuiTooltip
{...props}
classes={{ popper: className }}
placement={placement}
enterDelay={enterDelay}
enterNextDelay={enterDelay}
enterTouchDelay={enterDelay}
enterTouchDelay={enterTouchDelay}
arrow
/>
),
Expand Down
8 changes: 5 additions & 3 deletions packages/ui-components/src/components/TooltipIconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ const TooltipWrapper = styled.span`
}
&:hover,
&:focus {
svg {
fill: ${props => props.theme.palette.primary.main};
${({ theme }) => theme.breakpoints.up('md')} {
svg {
fill: ${props => props.theme.palette.primary.main};
}
}
}
`;
Expand All @@ -48,7 +50,7 @@ interface TooltipIconButtonProps {

export const TooltipIconButton = ({ tooltip, Icon = InfoOutlined }: TooltipIconButtonProps) => {
return (
<Tooltip title={tooltip} placement="top">
<Tooltip title={tooltip} placement="top" enterTouchDelay={500}>
<TooltipWrapper tabIndex={0} className="tooltip-icon">
<Icon />
</TooltipWrapper>
Expand Down

0 comments on commit 04ed541

Please sign in to comment.