You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
start typing or copy-pasting some very random long text.
The textarea height will eventually grow higher than the content itself
Expected Result
the textarea height match the content height
Actual Result
the textarea height is more than the content height
Version
0.74.2
Browsers tested
Chrome 61.0.3163.100
FireFox 55.0.3
Explanation
I think this happen because the way we calculate height. By setting height to auto the overflow content will sit in the textarea with a scroll bar. So scrollHeight will sometimes has a value larger than the actual content height without a scroll bar. Because there could be a scenario where the appearance of the scroll bar will push some words down to a new line.
I think this will happen in an environment where the scroll bar actually take spaces in the viewport.
Oh, you're fantastic. I was boggled over this some time ago and decided a couple extra pixels would just have to do. However, simply setting overflowY = 'hidden' when height = 'auto' produces the correct scrollHeight without the extra few pixels:
The exact height, in this case, is 2574. This is exactly what we get when adding the already calculated borderHeight of 2px (1x top 1px bottom) back in.
A PR setting/unsetting the overflowY style would be greatly appreciated!
Steps
textarea
height will eventually grow higher than the content itselfExpected Result
the
textarea
height match the content heightActual Result
the
textarea
height is more than the content heightVersion
0.74.2
Browsers tested
Chrome 61.0.3163.100
FireFox 55.0.3
Explanation
I think this happen because the way we calculate height. By setting
height
to auto the overflow content will sit in the textarea with a scroll bar. SoscrollHeight
will sometimes has a value larger than the actual content height without a scroll bar. Because there could be a scenario where the appearance of the scroll bar will push some words down to a new line.I think this will happen in an environment where the scroll bar actually take spaces in the viewport.
Testcase
https://codepen.io/WiNloSt/pen/qPxEaY
The text was updated successfully, but these errors were encountered: