-
Notifications
You must be signed in to change notification settings - Fork 889
fix: update textarea to fit content height and set a max height #17946
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
Conversation
id={id} | ||
className="max-w-2xl" | ||
className="overflow-y-auto max-h-[500px]" | ||
value={localValue} | ||
onChange={(e) => { | ||
const target = e.currentTarget; | ||
target.style.height = "auto"; |
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.
this is a static style and should be turned into a tailwind class as well
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.
When I test this, If I don't set height to auto in the onchange, the textarea height does not get updated correctly when the users adds and removes lines from the textarea
site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx
Outdated
Show resolved
Hide resolved
const resizeTextarea = useEffectEvent(() => { | ||
if (textareaRef.current) { | ||
const textarea = textareaRef.current; | ||
textarea.style.height = "auto"; |
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.
does this actually do anything? you overwrite it immediately
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.
you are right it was necessary in the onChange below but not needed here.
No description provided.