Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/custom/CustomTooltip/customTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ function CustomTooltip({
variant = 'standard',
bgColor = '#141414',
slotProps = {},
enterDelay = 100,
leaveDelay = 0,
...props
}: CustomTooltipProps): JSX.Element {
const theme = useTheme();

return (
<Tooltip
enterDelay={150}
enterNextDelay={400}
leaveDelay={700}
enterDelay={enterDelay}
leaveDelay={leaveDelay}
Comment on lines +30 to +39

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

When interactive is set to true on a tooltip, the user needs a brief window of time to move the mouse cursor from the anchor element to the tooltip content itself. Setting the default leaveDelay to 0 will cause the tooltip to close instantly as soon as the mouse leaves the anchor, making it impossible for users to interact with any content inside the tooltip (such as links or buttons).

To prevent this usability and accessibility issue, we should conditionally set the default leaveDelay based on whether interactive is enabled (e.g., defaulting to 300ms when interactive is true, and 0 otherwise).

  interactive,
  enterDelay = 100,
  leaveDelay = interactive ? 300 : 0,
  ...props
}: CustomTooltipProps): JSX.Element {
  const theme = useTheme();

  return (
    <Tooltip
      interactive={interactive}
      enterDelay={enterDelay}
      leaveDelay={leaveDelay}

slotProps={_.merge(
{
tooltip: {
Expand Down
Loading