Skip to content

Commit

Permalink
fix(QInput): keep total control size while calculating textarea autog…
Browse files Browse the repository at this point in the history
…row size (#5214)

close #5207
  • Loading branch information
pdanpdan authored and rstoenescu committed Oct 3, 2019
1 parent b89df7c commit 0828561
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui/src/components/input/QInput.js
Expand Up @@ -167,8 +167,15 @@ export default Vue.extend({
__adjustHeight () {
const inp = this.$refs.input
if (inp !== void 0) {
const parentStyle = inp.parentNode.style

// reset height of textarea to a small size to detect the real height
// but keep the total control size the same
parentStyle.marginBottom = (inp.scrollHeight - 1) + 'px'
inp.style.height = '1px'

inp.style.height = inp.scrollHeight + 'px'
parentStyle.marginBottom = ''
}
},

Expand Down

0 comments on commit 0828561

Please sign in to comment.