Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

IE11 getComputedStyle prevention #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0"
},
"dependencies": {
"autosize": "^3.0.15",
"autosize": "^4.0.0",
"line-height": "^0.3.1",
"prop-types": "^15.5.6"
}
Expand Down
16 changes: 14 additions & 2 deletions src/TextareaAutosize.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,21 @@ export default class TextareaAutosize extends React.Component {
this.updateLineHeight();

// this trick is needed to force "autosize" to activate the scrollbar
setTimeout(() => autosize(this.textarea));
setTimeout(() => {
try {
autosize(this.textarea);
} catch (e) {
// window.getComputedStyle throws Access is denied on IE
// console.error('Autosize Error:', e);
}
});
} else {
autosize(this.textarea);
try {
autosize(this.textarea);
} catch (e) {
// window.getComputedStyle throws Access is denied on IE
// console.error('Autosize Error:', e);
}
}

if (onResize) {
Expand Down