diff --git a/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx b/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx index d8985c0e1a2e..619f2369b312 100644 --- a/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx +++ b/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx @@ -54,7 +54,7 @@ const themedSyntax = memoize(2)((theme) => let copyToClipboard: (text: string) => Promise; -if (navigator.clipboard) { +if (navigator?.clipboard) { copyToClipboard = (text: string) => navigator.clipboard.writeText(text); } else { copyToClipboard = async (text: string) => {