0

I am having trouble creating an auto expanding textarea inside a position absolute div. This question answers how to make the autoexpanding textarea, however, this technique does not work when inside a position: absolute parent. The textarea will expand and shrink correctly up until the point when it reaches its max height at 85px. Then once you try and delete lines the textarea will not shrink correctly.

Here is a demo of the problem: http://codepen.io/anon/pen/mPeyzE

I'm guessing this has to do with some special condition with scrollHeight and the parent's height but I cannot find anything documented on this exact situation.

Community
  • 1
  • 1
kennyjwilli
  • 193
  • 3
  • 13
  • its working fine on my chrome 49. – L777 Mar 04 '16 at 01:34
  • I am on 49.0.2623.75 on Ubuntu and it is not working. Are you expanding and then deleting lines? – kennyjwilli Mar 04 '16 at 01:35
  • [**check this link**](https://i.gyazo.com/06088afd8a88c3329d3da853f825963a.gif) chrome 49.0.2623.75 windows vista – L777 Mar 04 '16 at 01:41
  • This is what is happening for me: http://imgur.com/zMFdUeD – kennyjwilli Mar 04 '16 at 02:09
  • @freestock.tk You did not add enough text to the textarea. You need to add more text so that the textarea stops expanding at a height of 85px and then delete the lines. – kennyjwilli Mar 04 '16 at 07:05
  • [**link**](https://i.gyazo.com/85274a90d840703c9706d8c1de84a5aa.gif) – L777 Mar 04 '16 at 07:14
  • I found the source of the bug: It only happens when you delete an empty line. [**Example if you press backspace in this situation, before to start of writing on this new line**](https://i.gyazo.com/b702a83b9110ee0cd0cd3cad62554afe.png) – L777 Mar 04 '16 at 07:19
  • Yes, you are correct! – kennyjwilli Mar 04 '16 at 07:31

1 Answers1

0

Its working fine for me on my chrome Version 48.0.2564.116 (64-bit) - Mac OSX.

Galeel Bhasha
  • 1,877
  • 13
  • 19
  • I have just tested this on my Mac, Chrome 48.0.2564.116 and confirmed the incorrect behavior. The textarea should return to its original size. If you hit return several times so that the textarea stops expanding and then hit delete until you can't anymore you will observe the incorrect behavior. – kennyjwilli Mar 04 '16 at 07:04