Skip to content

Commit 329ddea

Browse files
authored
fix: Tooltip delay removed when doing things other than hovering over tooltip trigger (#4162)
## Description closes #3477 ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent ae287ab commit 329ddea

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

packages/design-system/src/components/tooltip.stories.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1-
import { InputErrorsTooltip, TooltipProvider } from "./tooltip";
1+
import {
2+
InputErrorsTooltip,
3+
TooltipProvider,
4+
Tooltip as TooltipDesign,
5+
} from "./tooltip";
26
import { Button } from "./button";
37
import { Box } from "./box";
8+
import { InputField } from "./input-field";
49

510
export default {
611
title: "Library/Tooltip",
712
};
813

9-
const TooltipStory = () => {
14+
export const TooltipDelay = () => {
15+
return (
16+
<TooltipProvider>
17+
<TooltipDesign content="HELLO" delayDuration={1000}>
18+
<Button>Hover me</Button>
19+
</TooltipDesign>
20+
21+
<InputErrorsTooltip errors={[]} side={"right"}>
22+
<InputField
23+
id="input"
24+
placeholder="Input"
25+
css={{
26+
width: 200,
27+
}}
28+
/>
29+
</InputErrorsTooltip>
30+
</TooltipProvider>
31+
);
32+
};
33+
34+
export const Tooltip = () => {
1035
return (
1136
<TooltipProvider>
1237
<Box>Some content</Box>
@@ -59,5 +84,3 @@ const TooltipStory = () => {
5984
</TooltipProvider>
6085
);
6186
};
62-
63-
export { TooltipStory as Tooltip };

packages/design-system/src/components/tooltip.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,11 @@ export const InputErrorsTooltip = ({
218218
collisionBoundary={collisionBoundary as never}
219219
collisionPadding={-8}
220220
hideWhenDetached={true}
221-
content={content ?? " "}
221+
content={
222+
errors !== undefined && errors.length !== 0
223+
? (content ?? " ")
224+
: undefined
225+
}
222226
open={errors !== undefined && errors.length !== 0}
223227
side={side ?? "right"}
224228
css={css}

0 commit comments

Comments
 (0)