Updates fake element to use visually hidden styles

Uses the h5bp technique as seen in
https://github.com/h5bp/html5-boilerplate/blob/v5.0.0/src/css/main.css#L
126-L140
This commit is contained in:
Jonathan Neal 2015-12-08 22:10:24 -05:00
parent c12c610b22
commit 2a3be43534

View File

@ -56,9 +56,7 @@ export default class ClipboardAction {
this.fakeHandler = document.body.addEventListener('click', () => this.removeFake());
this.fakeElem = document.createElement('textarea');
this.fakeElem.style.position = 'absolute';
this.fakeElem.style.left = '-9999px';
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
this.fakeElem.style.cssText = 'border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px';
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;