Skip to content

Commit e6a3bc9

Browse files
committed
chore: cleanup
1 parent 6a2a508 commit e6a3bc9

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

site/src/components/CopyableValue/CopyableValue.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export const CopyableValue: FC<CopyableValueProps> = ({
2121
side = "bottom",
2222
children,
2323
className,
24+
role,
25+
tabIndex,
26+
onClick,
27+
onKeyDown,
28+
onKeyUp,
2429
...attrs
2530
}) => {
2631
const { showCopiedSuccess, copyToClipboard } = useClipboard();
@@ -43,10 +48,23 @@ export const CopyableValue: FC<CopyableValueProps> = ({
4348
>
4449
<TooltipTrigger asChild>
4550
<span
51+
ref={clickableProps.ref}
4652
{...attrs}
47-
{...clickableProps}
48-
role="button"
49-
tabIndex={0}
53+
className={cn("cursor-pointer", className)}
54+
role={role ?? clickableProps.role}
55+
tabIndex={tabIndex ?? clickableProps.tabIndex}
56+
onClick={(event) => {
57+
clickableProps.onClick(event);
58+
onClick?.(event);
59+
}}
60+
onKeyDown={(event) => {
61+
clickableProps.onKeyDown(event);
62+
onKeyDown?.(event);
63+
}}
64+
onKeyUp={(event) => {
65+
clickableProps.onKeyUp(event);
66+
onKeyUp?.(event);
67+
}}
5068
onMouseEnter={() => {
5169
setIsFocused(true);
5270
setTooltipOpen(true);
@@ -60,7 +78,6 @@ export const CopyableValue: FC<CopyableValueProps> = ({
6078
onBlur={() => {
6179
setTooltipOpen(false);
6280
}}
63-
className={cn("cursor-pointer", className)}
6481
>
6582
{children}
6683
</span>

0 commit comments

Comments
 (0)