Allow TextareaAutosize to use min-height instead of height
See original GitHub issueI want the textarea to always contain the text, but I also want it to be able to grow since it’s in a flex container.
Right now 'height'
is hardcoded into the library:
I just want to be able to change this to min-height
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Feature request initialHeight or minHeight #314 - GitHub
I'm setting the initialHeight or minHeight with minRows={2} but it's not exactly. There is a possibility to add an initial height.
Read more >Creating a textarea with auto-resize - javascript - Stack Overflow
height, is holding it open. You could instead take a max() of scrollHeight and a minimum height value you have predefined or calculated...
Read more >Textarea Autosize React component - Material UI - MUI
The Textarea Autosize component gives you a textarea HTML element that automatically adjusts its height to match the length of the content within....
Read more >Auto-Growing Inputs & Textareas | CSS-Tricks
For textareas, one classic technique is to count the number of line-breaks, use that to set the height, then multiply it by the...
Read more >Make a Textarea Auto Resize to fit Contents - Impressive Webs
Apply the height of the clone to the height of the textarea. The Code for Textarea Auto Resize. One of the keys to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have fixed this issue in a fork and no longer need upstream approval.
I hope you at least realize @Andarist that expecting this library to get layout right in all cases is not sustainable and will inevitably result in edge cases such as this one. I would highly recommend moving to min-height (and max-height if maxRows is specified) rather than expecting height to be completely infallible. Thank you for considering my issue and I am sorry that I was not able to provide enough detail.
Here is screenshot proof of your library getting the height blatantly wrong, and exactly why
min-height
>height
for this case:I tested this exact same HTML structure (a couple nested flexboxes) in codesandbox here and your library works there, but not in my app. No idea why. No time to debug.
What you can do is try to bisect the issue to demonstrate it, in an isolated form, on the codesandbox. I don’t believe in providing more options without knowing the full context behind it. If it doesn’t work in your app then is a reason for that and it should be found first and then evaluated. I’m not necessarily saying that the proposed solution is wrong but until a repro case is found I can’t see the full picture that is needed for me to justify making any changes here.