Skip to content

Commit

Permalink
Does not display tooltip if is nullish
Browse files Browse the repository at this point in the history
  • Loading branch information
nighto committed Oct 29, 2024
1 parent 2ca638d commit 292cfd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/components/overlays/Tooltip/TooltipProvider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,15 @@ export const TooltipDraggable: Story = {
name: 'Tooltip (draggable anchor)',
render: () => <TooltipWithDrag/>,
};

export const TooltipEmpty: Story = {
args: {
tooltip: '',
},
};

export const TooltipNull: Story = {
args: {
tooltip: null,
},
};
2 changes: 1 addition & 1 deletion src/components/overlays/Tooltip/TooltipProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const TooltipProvider = (props: TooltipProviderProps) => {
}, [isMounted, onTooltipActivated, onTooltipDeactivated]);

const renderTooltip = () => {
if (!isMounted) { return null; }
if (!isMounted || !tooltip) { return null; }

const floatingProps = getFloatingProps({
popover: 'manual',
Expand Down

0 comments on commit 292cfd8

Please sign in to comment.