Skip to content

Commit e5102e8

Browse files
committed
stop event propagation on ClickToCopy
1 parent 6dd8495 commit e5102e8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

components/click-to-copy.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ export function ClickToCopy({ children, text, ...props }: ClickToCopyProps) {
3636
return () => clearTimeout(timeout);
3737
}, [opening]);
3838

39-
const handleCopy = () => {
39+
const handleCopy = (
40+
e:
41+
| React.MouseEvent<HTMLSpanElement, MouseEvent>
42+
| React.KeyboardEvent<HTMLSpanElement>,
43+
) => {
44+
e.preventDefault();
4045
setCopied(true);
4146
setOpening(true);
4247
setOpen(true);
@@ -67,5 +72,5 @@ export function ClickToCopy({ children, text, ...props }: ClickToCopyProps) {
6772
</Tooltip>
6873
</TooltipProvider>
6974
);
70-
// biome-ignore-end lint/a11y/noStaticElementInteractions: ignore
75+
// biome-ignore-end lint/a11y/noStaticElementInteractions: ignore
7176
}

0 commit comments

Comments
 (0)