mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Prevent FF < 41 scrolling to bottom of page
In Firefox < 41, the selecting fakeElem.select() would cause the browser to scroll to the bottom of the page. By positioning fakeElem at the current scroll position, but still way out to the left, that no longer happens.
This commit is contained in:
parent
a4c8bc5bf0
commit
5c8af54b8a
@ -56,6 +56,7 @@ class ClipboardAction {
|
||||
this.fakeElem = document.createElement('textarea');
|
||||
this.fakeElem.style.position = 'absolute';
|
||||
this.fakeElem.style.left = '-9999px';
|
||||
this.fakeElem.style.top = document.body.scrollTop + 'px';
|
||||
this.fakeElem.setAttribute('readonly', '');
|
||||
this.fakeElem.value = this.text;
|
||||
this.selectedText = this.text;
|
||||
|
Loading…
Reference in New Issue
Block a user