From e6408d73d1dc7930ef995b5f90bb82925064e95a Mon Sep 17 00:00:00 2001 From: Connor Elsea Date: Thu, 2 Jan 2025 15:58:30 -0600 Subject: [PATCH 1/6] fix(components): fix tooltip staying open, add keys, fix AnimatePresence --- packages/components/tooltip/src/tooltip.tsx | 7 ++-- .../tooltip/stories/tooltip.stories.tsx | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/components/tooltip/src/tooltip.tsx b/packages/components/tooltip/src/tooltip.tsx index e014eb8944..c77dc5c5c5 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 ? ( - + {disableAnimation ? ( + isOpen &&
{content}
@@ -88,7 +89,7 @@ const Tooltip = forwardRef<"div", TooltipProps>((props, ref) => { ) : ( {isOpen ? ( - {animatedContent} + {animatedContent} ) : null} )} diff --git a/packages/components/tooltip/stories/tooltip.stories.tsx b/packages/components/tooltip/stories/tooltip.stories.tsx index 69658e10ef..8a0e091431 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, + }, +}; \ No newline at end of file From ab7167e3a9431acb5d3abdcef87f15e67b7d9c0d Mon Sep 17 00:00:00 2001 From: Connor Elsea Date: Fri, 3 Jan 2025 17:59:12 -0600 Subject: [PATCH 2/6] chore(changeset) add changeset for tooltip retention fix --- .changeset/two-insects-provide.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/two-insects-provide.md diff --git a/.changeset/two-insects-provide.md b/.changeset/two-insects-provide.md new file mode 100644 index 0000000000..4e21023cc5 --- /dev/null +++ b/.changeset/two-insects-provide.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/tooltip": minor +--- + +fix tooltip staying open on fast movement by adding proper motion keys and ensuring AnimatePresence stays rendered, no breaking changes or usage changes required From 709d5740c6d83544bcb7b2c0731cffaf4721e461 Mon Sep 17 00:00:00 2001 From: Connor Elsea Date: Fri, 3 Jan 2025 18:08:29 -0600 Subject: [PATCH 3/6] chore(changeset) update changeset text based on codebrabbit feedback --- .changeset/two-insects-provide.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.changeset/two-insects-provide.md b/.changeset/two-insects-provide.md index 4e21023cc5..a564fcfdd1 100644 --- a/.changeset/two-insects-provide.md +++ b/.changeset/two-insects-provide.md @@ -2,4 +2,9 @@ "@nextui-org/tooltip": minor --- -fix tooltip staying open on fast movement by adding proper motion keys and ensuring AnimatePresence stays rendered, no breaking changes or usage changes required +fix tooltip staying open on fast movement by: +- adding unique motion keys to tooltip content for proper animation tracking +- ensuring AnimatePresence component remains mounted until animations complete +- improving render performance during rapid tooltip transitions + +No breaking changes or usage changes required. From fc1b18a4ed19ef047a54e577f52187d230b42120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D5=A1=D3=84=D5=A1?= Date: Sat, 4 Jan 2025 11:15:38 +0800 Subject: [PATCH 4/6] chore(changeset): update changset message --- .changeset/two-insects-provide.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.changeset/two-insects-provide.md b/.changeset/two-insects-provide.md index a564fcfdd1..f243bed6bf 100644 --- a/.changeset/two-insects-provide.md +++ b/.changeset/two-insects-provide.md @@ -1,10 +1,5 @@ --- -"@nextui-org/tooltip": minor +"@nextui-org/tooltip": patch --- -fix tooltip staying open on fast movement by: -- adding unique motion keys to tooltip content for proper animation tracking -- ensuring AnimatePresence component remains mounted until animations complete -- improving render performance during rapid tooltip transitions - -No breaking changes or usage changes required. +fix tooltip staying open on fast movement issue (#4301) From 312aedec06c61f4d62454adf9ad9966919a5d7ba Mon Sep 17 00:00:00 2001 From: WK Wong Date: Wed, 15 Jan 2025 22:12:56 +0800 Subject: [PATCH 5/6] fix(tooltip): lint --- packages/components/tooltip/src/tooltip.tsx | 16 ++++++++++------ .../tooltip/stories/tooltip.stories.tsx | 18 +++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/components/tooltip/src/tooltip.tsx b/packages/components/tooltip/src/tooltip.tsx index c77dc5c5c5..fb6af46d5b 100644 --- a/packages/components/tooltip/src/tooltip.tsx +++ b/packages/components/tooltip/src/tooltip.tsx @@ -81,15 +81,19 @@ const Tooltip = forwardRef<"div", TooltipProps>((props, ref) => { <> {trigger} {disableAnimation ? ( - isOpen && -
- {content} -
-
+ 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 8a0e091431..dbd53b61d8 100644 --- a/packages/components/tooltip/stories/tooltip.stories.tsx +++ b/packages/components/tooltip/stories/tooltip.stories.tsx @@ -265,28 +265,28 @@ const ControlledTemplate = (args: TooltipProps) => { const ManyTemplate = (args: TooltipProps) => (
- + - + - + - + - + - + - + - +
@@ -431,4 +431,4 @@ export const Many = { args: { ...defaultProps, }, -}; \ No newline at end of file +}; From bd368a00b1e3bf736d603dab83592ffd704157d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D5=A1=D3=84=D5=A1?= Date: Sat, 18 Jan 2025 21:05:32 +0800 Subject: [PATCH 6/6] chore(changeset): update package name --- .changeset/two-insects-provide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/two-insects-provide.md b/.changeset/two-insects-provide.md index f243bed6bf..c8c47b7d6f 100644 --- a/.changeset/two-insects-provide.md +++ b/.changeset/two-insects-provide.md @@ -1,5 +1,5 @@ --- -"@nextui-org/tooltip": patch +"@heroui/tooltip": patch --- fix tooltip staying open on fast movement issue (#4301)