diff --git a/.changeset/two-insects-provide.md b/.changeset/two-insects-provide.md new file mode 100644 index 0000000000..c8c47b7d6f --- /dev/null +++ b/.changeset/two-insects-provide.md @@ -0,0 +1,5 @@ +--- +"@heroui/tooltip": patch +--- + +fix tooltip staying open on fast movement issue (#4301) diff --git a/packages/components/tooltip/src/tooltip.tsx b/packages/components/tooltip/src/tooltip.tsx index e014eb8944..fb6af46d5b 100644 --- a/packages/components/tooltip/src/tooltip.tsx +++ b/packages/components/tooltip/src/tooltip.tsx @@ -61,6 +61,7 @@ const Tooltip = forwardRef<"div", TooltipProps>((props, ref) => {
((props, ref) => { return ( <> {trigger} - {disableAnimation && isOpen ? ( - -
- {content} -
-
+ {disableAnimation ? ( + isOpen && ( + +
+ {content} +
+
+ ) ) : ( {isOpen ? ( - {animatedContent} + + {animatedContent} + ) : null} )} diff --git a/packages/components/tooltip/stories/tooltip.stories.tsx b/packages/components/tooltip/stories/tooltip.stories.tsx index 69658e10ef..dbd53b61d8 100644 --- a/packages/components/tooltip/stories/tooltip.stories.tsx +++ b/packages/components/tooltip/stories/tooltip.stories.tsx @@ -263,6 +263,35 @@ const ControlledTemplate = (args: TooltipProps) => { ); }; +const ManyTemplate = (args: TooltipProps) => ( +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+); + export const Default = { args: { ...defaultProps, @@ -395,3 +424,11 @@ export const Disabled = { isDisabled: true, }, }; + +export const Many = { + render: ManyTemplate, + + args: { + ...defaultProps, + }, +};