We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7040ba commit fce625fCopy full SHA for fce625f
src/clipboard-action.js
@@ -63,7 +63,10 @@ class ClipboardAction {
63
this.fakeElem.style.position = 'absolute';
64
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
65
// Move element to the same position vertically
66
- this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
+ let yPosition = window.pageYOffset || document.documentElement.scrollTop;
67
+ this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
68
+ this.fakeElem.style.top = yPosition + 'px';
69
+
70
this.fakeElem.setAttribute('readonly', '');
71
this.fakeElem.value = this.text;
72
0 commit comments