Skip to content

Commit

Permalink
Adds explanations on textarea styling #143 #179 #180
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed Feb 4, 2016
1 parent 4c9e29a commit bc9bcdd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/clipboard-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ export default class ClipboardAction {
this.fakeHandler = document.body.addEventListener('click', () => this.removeFake());

this.fakeElem = document.createElement('textarea');
// Prevent zooming on iOS
this.fakeElem.style.fontSize = '12pt';
// Reset box model
this.fakeElem.style.border = '0';
this.fakeElem.style.padding = '0';
this.fakeElem.style.margin = '0';
// Move element out of screen horizontally
this.fakeElem.style.position = 'absolute';
this.fakeElem.style.fontSize = '12pt'; // Prevent zooming on iPhones.
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
// Move element to the same position vertically
this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;
Expand Down

0 comments on commit bc9bcdd

Please sign in to comment.