This commit is contained in:
Zeno Rocha 2016-10-16 18:53:34 -07:00
parent f7040bae8a
commit fce625f151
No known key found for this signature in database
GPG Key ID: 7BEB4BBA4108C63F

View File

@ -63,7 +63,10 @@ class ClipboardAction {
this.fakeElem.style.position = 'absolute';
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
// Move element to the same position vertically
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
let yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
this.fakeElem.style.top = yPosition + 'px';
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;