From e07bfcceb0453bee0e78dcb067169e0e72a8d271 Mon Sep 17 00:00:00 2001 From: "Ghislain B." Date: Sat, 16 Nov 2024 00:39:57 -0500 Subject: [PATCH] fix: ExternalCopyManager shouldn't change body scroll pos, fixes #1078 (#1080) --- src/plugins/slick.cellexternalcopymanager.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/slick.cellexternalcopymanager.ts b/src/plugins/slick.cellexternalcopymanager.ts index b1309570..ac02b9b3 100644 --- a/src/plugins/slick.cellexternalcopymanager.ts +++ b/src/plugins/slick.cellexternalcopymanager.ts @@ -162,11 +162,12 @@ export class SlickCellExternalCopyManager implements SlickPlugin { protected _createTextBox(innerText: string) { + const scrollPos = document.documentElement.scrollTop || document.body.scrollTop; const ta = document.createElement('textarea'); ta.style.position = 'absolute'; - ta.style.left = '-1000px'; - ta.style.top = document.body.scrollTop + 'px'; + ta.style.opacity = '0'; ta.value = innerText; + ta.style.top = `${scrollPos}px`; this._bodyElement.appendChild(ta); ta.select();