Skip to content

Commit

Permalink
Fixed #847 - Textarea autoresize does not respect its border
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Jan 20, 2021
1 parent 1937999 commit 5f87373
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/textarea/Textarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export default {
},
methods: {
resize() {
const style = window.getComputedStyle(this.$el);
this.$el.style.height = 'auto';
this.$el.style.height = this.$el.scrollHeight + 'px';
this.$el.style.height = `calc(${style.borderTopWidth} + ${style.borderBottomWidth} + ${this.$el.scrollHeight}px)`;
if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) {
this.$el.style.overflowY = "scroll";
Expand Down

0 comments on commit 5f87373

Please sign in to comment.