-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let textarea inputs grow dynamically #970
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, thats nice! Though when testing, I noticed that there is still a tiny bit of scrolling for me (in Firefox and Chrome). No idea why.
frontend/src/ui/Input.tsx
Outdated
textAreaRef.current.style.height = "auto"; | ||
textAreaRef.current.style.height = `${e.target.scrollHeight}px`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you set this to auto
first to make scrollHeight
have the correct value? Like mentioned in this one article? If so, please add a comment, because otherwise the first assignment seems useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I adapted this solution from this article though I made some adjustments, as I found that some things work differently than described there.
In Tobira's case, the auto
thing is needed for another reason than stated there, but it's not useless.
Without it, the height of the textarea decreases by a small amount whenever a single char is deleted, like:
Bildschirmaufnahme.2023-10-23.um.12.34.12.mov
Setting this to auto
fixes this, but I don't know how best to explain this in a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heck? 0.o where is that behavior coming from :D Crazy. Does setting it to 0px
also work? Instead of auto
? So this seems a bit fishy and maybe worth investigating. But on the other hand, it works now, maybe it's just fine merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite some remaining weirdness, we decided to merge. Even in the worst case, the textbox will be usable, so it's safe to merge.
Closes #576
Applies to textareas for text block editing and the description textbox on the upload page.