diff --git a/components/ui/Code.tsx b/components/ui/Code.tsx index 8ca02b8..d17060b 100644 --- a/components/ui/Code.tsx +++ b/components/ui/Code.tsx @@ -8,19 +8,22 @@ import clsx from 'clsx' export function Code({children}: { children: ReactNode }) { const [copied, setCopied] = useState(false) const preRef = useRef(null) + const buttonRef = useRef(null) const handleCopy = async (e: React.MouseEvent) => { e.preventDefault() await navigator.clipboard.writeText(preRef.current?.innerText ?? '') setCopied(true) setTimeout(() => setCopied(false), 1000) + buttonRef.current?.blur() } return (