I'm making a "fluid" textarea, which resizes it's height according to it's content. I'm actually trying to implement this script. I have the following code: https://ellie-app.com/Vjtvm6yrKWa1/4
The issue is that when increasing, it works with no problem, but when trying to decrease height, it doesn't work as expected.
How to reproduce the issue:
- The textarea comes with a default text. If you click on the textarea, it will resize it's height to the content.
- Delete half of the text or the entire text.
- Click in the textarea again. The expected behaivor is that it should resize it's height again,recuding it's height, but it doesn't. It does either nothing or reduces the height just a little (making you have to click a lot of times until the height is ok)
I think it's something related to the virual-dom preventing the scrollHeight to change, something like a cache (performance-wise), but it's only a guess.
What could be my problem?
Ps. When trying to use other kind of events, like "input" or "change", this issue also occurs.