Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Tooltip delay removed when doing things other than hovering over tooltip trigger (#4162)

Ivan Starkov329ddea871af
diff --git a/packages/design-system/src/components/tooltip.stories.tsx b/packages/design-system/src/components/tooltip.stories.tsx
index c36955b7c5..5b4296b8c4 100644
--- a/packages/design-system/src/components/tooltip.stories.tsx
+++ b/packages/design-system/src/components/tooltip.stories.tsx
@@ -1,12 +1,37 @@
-import { InputErrorsTooltip, TooltipProvider } from "./tooltip";
+import {
+ InputErrorsTooltip,
+ TooltipProvider,
+ Tooltip as TooltipDesign,
+} from "./tooltip";
import { Button } from "./button";
import { Box } from "./box";
+import { InputField } from "./input-field";
export default {
title: "Library/Tooltip",
};
-const TooltipStory = () => {
+export const TooltipDelay = () => {
+ return (
+ <TooltipProvider>
+ <TooltipDesign content="HELLO" delayDuration={1000}>
+ <Button>Hover me</Button>
+ </TooltipDesign>
+
+ <InputErrorsTooltip errors={[]} side={"right"}>
+ <InputField
+ id="input"
+ placeholder="Input"
+ css={{
+ width: 200,
+ }}
+ />
+ </InputErrorsTooltip>
+ </TooltipProvider>
+ );
+};
+
+export const Tooltip = () => {
return (
<TooltipProvider>
<Box>Some content</Box>
@@ -59,5 +84,3 @@ const TooltipStory = () => {
</TooltipProvider>
);
};
-
-export { TooltipStory as Tooltip };
diff --git a/packages/design-system/src/components/tooltip.tsx b/packages/design-system/src/components/tooltip.tsx
index 8686b89239..bfbe78c53b 100644
--- a/packages/design-system/src/components/tooltip.tsx
+++ b/packages/design-system/src/components/tooltip.tsx
@@ -218,7 +218,11 @@ export const InputErrorsTooltip = ({
collisionBoundary={collisionBoundary as never}
collisionPadding={-8}
hideWhenDetached={true}
- content={content ?? " "}
+ content={
+ errors !== undefined && errors.length !== 0
+ ? (content ?? " ")
+ : undefined
+ }
open={errors !== undefined && errors.length !== 0}
side={side ?? "right"}
css={css}