Prevents scroll jump on iOS when using "data-clipboard-text"

Thanks to @geraldarthur at #369
This commit is contained in:
Zeno Rocha
2017-02-07 21:56:42 -08:00
parent 63d1b0f014
commit 3696739e5e
4 changed files with 13 additions and 5 deletions

View File

@@ -64,7 +64,6 @@ class ClipboardAction {
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
// Move element to the same position vertically
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', '');