Skip to content

Commit

Permalink
fix: interactivity for components within tooltip body [INS-4773] (#8239)
Browse files Browse the repository at this point in the history
Attempting to click on links within tooltips would lead to the tooltip being dismissed. This fixes the issue by moving the tooltip to be a sibling of the tooltip trigger, which is the correct structure for react-aria tooltips. Ref: https://react-spectrum.adobe.com/react-aria/useTooltipTrigger.html
  • Loading branch information
godfrzero authored Dec 11, 2024
1 parent d6a6bcb commit eca35d8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/insomnia/src/ui/components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ export const Tooltip = (props: Props) => {
});

return (
<div
ref={triggerRef}
className={tooltipClasses}
style={{ position: 'relative', ...style }}
{...trigger.triggerProps}
onClick={props.onClick}
>
{children}
<>
<div
ref={triggerRef}
className={tooltipClasses}
style={{ position: 'relative', ...style }}
{...trigger.triggerProps}
onClick={props.onClick}
>
{children}
</div>
{state.isOpen && (
<OverlayContainer>
<div
Expand All @@ -69,6 +71,6 @@ export const Tooltip = (props: Props) => {
</div>
</OverlayContainer>
)}
</div>
</>
);
};

0 comments on commit eca35d8

Please sign in to comment.