From 9af29fb2d7330cb89510415360778e5038611dba Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 18:35:03 +0000 Subject: [PATCH 1/2] docs(SmartLink): Handle clipboard write permission denied error --- src/components/smartLink.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/smartLink.tsx b/src/components/smartLink.tsx index 58ef69bef4e98..07606db29c492 100644 --- a/src/components/smartLink.tsx +++ b/src/components/smartLink.tsx @@ -30,10 +30,14 @@ export function SmartLink({ }: Props) { const realTo = to || href || ''; - const handleAutolinkClick = useCallback((e: React.MouseEvent) => { + const handleAutolinkClick = useCallback(async (e: React.MouseEvent) => { const link = e.currentTarget as HTMLAnchorElement; if (link.classList.contains('autolink-heading')) { - navigator.clipboard.writeText(link.href); + try { + await navigator.clipboard.writeText(link.href); + } catch { + // Clipboard write permission may be denied in some environments; ignore silently + } } }, []); From fb64d9216ef88bf612ea5c91584285b141bc42e7 Mon Sep 17 00:00:00 2001 From: Shannon Anahata Date: Wed, 27 May 2026 15:53:35 -0700 Subject: [PATCH 2/2] docs(SmartLink): Handle clipboard write permission denied error Wrap navigator.clipboard.writeText() in a try/catch and log permission denials via Sentry.logger.warn() instead of letting them bubble up as unhandled rejections. This addresses NotAllowedError exceptions in environments where clipboard access is restricted (headless Chrome, Linux, Android WebView) as well as 'Document is not focused' errors when users switch tabs mid-click. Fixes DOCS-84P DOCS-85V DOCS-5YP DOCS-961 DOCS-APQ --- src/components/smartLink.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/smartLink.tsx b/src/components/smartLink.tsx index 07606db29c492..5c902928bc153 100644 --- a/src/components/smartLink.tsx +++ b/src/components/smartLink.tsx @@ -1,5 +1,6 @@ 'use client'; +import * as Sentry from '@sentry/nextjs'; import Link from 'next/link'; import {useCallback} from 'react'; @@ -36,7 +37,10 @@ export function SmartLink({ try { await navigator.clipboard.writeText(link.href); } catch { - // Clipboard write permission may be denied in some environments; ignore silently + Sentry.logger.warn('clipboard.writeText permission denied', { + url: link.href, + userAgent: navigator.userAgent, + }); } } }, []);