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 571f883 commit dd9ce28
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/common/src/extensions/slickCellExternalCopyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ export class SlickCellExternalCopyManager {
// ---------------------

protected createTextBox(innerText: string): HTMLTextAreaElement {
const textAreaElm = createDomElement(
'textarea',
{
value: innerText,
style: { position: 'absolute', left: '-1000px', top: `${document.body.scrollTop}px`, }
},
this._bodyElement);
const scrollPos = document.documentElement.scrollTop || document.body.scrollTop;
const textAreaElm = createDomElement('textarea', {
value: innerText,
style: {
position: 'absolute',
opacity: '0',
top: `${scrollPos}px`
}
}, this._bodyElement);
textAreaElm.select();

return textAreaElm;
Expand Down

0 comments on commit dd9ce28

Please sign in to comment.