Skip to content

Commit

Permalink
fix(QIput): do not change overflow on autogrow textarea because it br…
Browse files Browse the repository at this point in the history
…eaks undo and does not compute size as expected quasarframework#14344, quasarframework#14263, quasarframework#13196
  • Loading branch information
pdanpdan committed Sep 15, 2022
1 parent 77f33e3 commit 05080ef
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions ui/src/components/input/QInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,24 @@ export default Vue.extend({

// textarea only
__adjustHeight () {
const inp = this.$refs.input
if (inp !== void 0) {
const parentStyle = inp.parentNode.style
const { overflow } = inp.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.overflow = 'hidden'

inp.style.height = inp.scrollHeight + 'px'
inp.style.overflow = overflow
parentStyle.marginBottom = ''
}
requestAnimationFrame(() => {
const inp = this.$refs.input
if (inp !== void 0) {
const parentStyle = inp.parentNode.style
const { overflow } = inp.style

// reset height of textarea to a small size to detect the real height
// but keep the total control size the same
// Firefox rulez #14263, #14344
this.$q.platform.is.firefox !== true && (inp.style.overflow = 'hidden')
inp.style.height = '1px'
parentStyle.marginBottom = (inp.scrollHeight - 1) + 'px'

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

__getCurValue () {
Expand Down

0 comments on commit 05080ef

Please sign in to comment.