Skip to content

Commit

Permalink
feat: Increase info tooltip accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyCoffee committed Apr 21, 2024
1 parent 3c1ad25 commit f8d9f1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/components/InfoHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import { PropsWithChildren } from "react"

import { Info } from "lucide-react"

import { textColor } from "~/utils/colors"

import { Icon } from "./Icon"
import { TitleTooltip } from "./TitleTooltip"

export const InfoHint = ({ children }: PropsWithChildren) => (
<TitleTooltip title={children as string} asChild>
<span className="inline-flex size-8 items-center justify-center">
<Icon icon={Info} color="muted" size="sm" />
<Icon
icon={Info}
color="current"
size="sm"
className={textColor({ color: "blue" })}
/>
</span>
</TitleTooltip>
)
2 changes: 1 addition & 1 deletion src/components/TitleTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const TitleTooltip = ({
!title || disabled ? (
children
) : (
<Tooltip.Root disableHoverableContent>
<Tooltip.Root disableHoverableContent delayDuration={300}>
<Tooltip.Trigger asChild={asChild}>{children}</Tooltip.Trigger>
<Tooltip.Portal>
<Tooltip.Content side={side} className="max-w-64">
Expand Down

0 comments on commit f8d9f1d

Please sign in to comment.