Skip to content

Commit

Permalink
Fix broken ctrl-z in on firefox
Browse files Browse the repository at this point in the history
In TextArea ctrl-z is currently broken on firefox if autoHeight is enabled.

I feel like it might be a firefox bug but this workaround will make it work.
  • Loading branch information
ericls committed Dec 18, 2018
1 parent 6d7feef commit a36a736
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/addons/TextArea/TextArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ class TextArea extends Component {
const borderHeight = _.sum([borderBottomWidth, borderTopWidth].map(x => parseFloat(x)))

// Measure the scrollHeight and update the height to match.
const scrollHeight = this.ref.scrollHeight
this.ref.style.height = 'auto'
this.ref.style.overflowY = 'hidden'
this.ref.style.height = `${Math.max(
parseFloat(minHeight),
Math.ceil(this.ref.scrollHeight + borderHeight),
Math.ceil(scrollHeight + borderHeight),
)}px`
this.ref.style.overflowY = ''
}
Expand Down

0 comments on commit a36a736

Please sign in to comment.