react-textarea-autosize icon indicating copy to clipboard operation
react-textarea-autosize copied to clipboard

Specific content length leads to unintended behavior after load

Open christoph-fricke opened this issue 6 years ago • 5 comments

Version: latest

https://codesandbox.io/s/lxqqw4k9rq

This example shows a use of the textarea where it should extend from 1 to 2 lines before showing a scrollbar. The predefined given content however leads to a situation where the textarea already shows a scrollbar after load instead of extending to a new line. Editing the value shows that it extends correctly if you add a few more characters and that it would even fit on one line.

I thing it has something to do with the length of the content with consideration about the style (since it effects the length).

christoph-fricke avatar Oct 21 '18 11:10 christoph-fricke

Could u specify ur OS & browser? A gif presenting what do you see would be also helpful.

I can't reproduce on my machine.

Andarist avatar Oct 21 '18 20:10 Andarist

@Andarist Sorry forgot to mention it. The Bug appears in Win10 as shown in the gif in:

  • Chrome
  • Edge
  • IE

It renders in one line in FireFox however the line is still slightly scrollable.

textarea-bug

christoph-fricke avatar Oct 22 '18 12:10 christoph-fricke

I was getting unexpected overflow behavior (scrollbars showing up "sometimes". I was able to get the behavior I wanted with style={{overflow: 'hidden', }}. Hopefully that works for you.

s4l4x avatar Jan 07 '19 16:01 s4l4x

@s4l4x Thanks that works. However this is only a viable solution if you do not use the max-row prop. Otherwise overflow: hidden; also hides the scrollbar when textarea-autosize reaches the max row cap which prevents further line (and content) from being shown.

christoph-fricke avatar Jan 08 '19 10:01 christoph-fricke

Unfortunately I had no time to investigate this and I'm not sure when I will be able to do so, I'd appreciate any help with fixing this appropriately.

Andarist avatar Jan 08 '19 12:01 Andarist