diff --git a/.changeset/khaki-islands-bathe.md b/.changeset/khaki-islands-bathe.md new file mode 100644 index 00000000..dce504bb --- /dev/null +++ b/.changeset/khaki-islands-bathe.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/site-kit': patch +--- + +(fix) Await copy function in CopyCodeButton diff --git a/packages/site-kit/src/lib/docs/DocsCopyCodeButton.svelte b/packages/site-kit/src/lib/docs/DocsCopyCodeButton.svelte index b5540296..cd662428 100644 --- a/packages/site-kit/src/lib/docs/DocsCopyCodeButton.svelte +++ b/packages/site-kit/src/lib/docs/DocsCopyCodeButton.svelte @@ -8,9 +8,9 @@ let copying = false; - function copy() { + async function copy() { try { - navigator.clipboard.writeText(code); + await navigator.clipboard.writeText(code); } catch { /** * This is the fallback deprecated way of copying text to the clipboard. Only runs if it can't find the clipboard API.