-
-
Notifications
You must be signed in to change notification settings - Fork 13
Issue when textarea reaches the end of the window height size #82
Comments
It works fine for me, what's the issue? |
In the screenshot above, the textarea does not resize with the content, and that is what this library is supposed to do. If you run the Storybook examples ( There are 7 examples, and none of them function. |
The solution might be to create another textarea that is hidden, with the same text as the "real" textarea, that can be used to fetch the height the expanding textarea should set to |
I'm aware of this technique, but I'm personally not a fan of having duplicate markup and content like that in the browser for a few reasons. I will try to find a different solution. Thanks for your patience |
@SunnyAureliusRichard If you get a moment, are you able to evaluate #85? If I don't hear back within a few days, I'll ship it out and follow back up here. |
Hi @rpearce Thank you for this. It does seem to fix the problem, but it's not as smooth as it could be. Here is "Style changes" story with the line "height = 0" commented out, and without the fix you've suggested. Notice that when I add more lines, the page continues to scroll down. And here is the same story, with the line "height = 0" left in, and with the fix you've suggested. Notice that when I add more lines, the page scrolls up, and only a part of the textarea is visible. Thanks |
Thanks for taking a look. When I get some time, I'll see if maybe I only do the |
I think doing that will result in the same difference between the gifs in the last post. I know why it's important to have height = 0. I don't know an elegant way to fix this either. It's definitely a tricky one. |
Commenting back here as I'm running into the same issue. Any plan to merge in the PR or try the Thank you! |
@templeman15 Both approaches have their own issue (see my note above about that I'll consider this an opportunity to think about it a little more. |
@rpearce just looping back, I ended up switching to:
Maybe you could check out what they're doing. Best of luck 👍🏼 |
I've spent a couple of nights refactoring this project to find a simpler way. I need to do way more testing, but I may have just re-implemented this in We'll see how this shakes out! There's a good deal bit to play with. Stay tuned... |
I've got a few too many things going on, and I've paused this update and will get back to it at some point. |
We're encountering this issue, too. Sounds like there might not have been any progress on it, but let us know if you fix this issue! |
It's a pretty tough issue without doing a rewrite. When I was rewriting this, I found I was actually recreating https://github.com/Andarist/react-textarea-autosize I hate saying this, but it's enough of an issue that I think I'll need to recommend using that library over my own. I simply don't have time to invest in an already-well-solved problem. It's not a great answer, but it is one. Are you ok trying out the other library and checking back in here? |
Greetings!
There's an issue with the view height flipping between where the cursor is, and the top of the page.
Demo available @ https://codesandbox.io/s/tailwind-css-and-react-forked-qhfgif?file=/src/components/Homepage.js
To reproduce, do the same as in the gif:
![react-expanding-textarea](https://user-images.githubusercontent.com/100728856/156470201-5be83696-1873-4621-8777-04e117fe95b1.gif)
PS: in the README.md file for the label it should be
htmlFor="my-textarea"
--- notfor="my-textarea"
To fix, this line has to be commented out
el.style.height = '0'
The text was updated successfully, but these errors were encountered: