Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions packages/design-system/src/components/tooltip.stories.tsx
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -59,5 +84,3 @@ const TooltipStory = () => {
</TooltipProvider>
);
};

export { TooltipStory as Tooltip };
6 changes: 5 additions & 1 deletion packages/design-system/src/components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down