Skip to content

Commit

Permalink
fix: ExternalCopyManager shouldn't change body scroll pos, fixes #1078
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Nov 16, 2024
1 parent 6d8261c commit 3112099
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/slick.cellexternalcopymanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 3112099

Please sign in to comment.