From f7a7e6fc7f77576db14cfe8d7bbb877688c17dd8 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Thu, 13 Apr 2023 14:30:16 +0100 Subject: [PATCH] fix: copy scrolling to bottom --- src/lib/helpers/copy.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/helpers/copy.ts b/src/lib/helpers/copy.ts index 6399995ea..4c3779ffc 100644 --- a/src/lib/helpers/copy.ts +++ b/src/lib/helpers/copy.ts @@ -11,6 +11,12 @@ async function securedCopy(value: string) { function unsecuredCopy(value: string) { const textArea = document.createElement('textarea'); textArea.value = value; + + // Avoid scrolling to bottom + textArea.style.top = '0'; + textArea.style.left = '0'; + textArea.style.position = 'fixed'; + document.body.appendChild(textArea); textArea.focus(); textArea.select();