TextArea incorrect height with autoHeight prop when element is not visible
See original GitHub issueUpdate Managed to find out exactly why this issue happens. Will come back and edit this with and jsfiddle that replicates exactly this issue. Spoiler, it has to do with setting tabular items.
I am getting this weird issue when using Form.TextArea
with autoHeight
and disabled
props. The height of the textarea is not set correctly as you can see in the SS below:
Here is the JSX:
<Grid>
<Grid.Row columns={2}>
<Grid.Column>
<Header size="small">General Conditions</Header>
<Form.TextArea label="Textarea 1" defaultValue="Lorem Ipsum" disabled readOnly autoHeight />
</Grid.Column>
<Grid.Column>
<Header size="small">Special Conditions</Header>
<Form.TextArea label=" " defaultValue="Lorem Ipsum" disabled readOnly autoHeight />
</Grid.Column>
</Grid.Row>
<Grid.Row columns={2}>
<Grid.Column>
<Form.TextArea label="Textarea 2" defaultValue="Lorem Ipsum" disabled readOnly autoHeight />
</Grid.Column>
<Grid.Column>
<Form.TextArea label=" " defaultValue="Lorem Ipsum" disabled readOnly autoHeight />
</Grid.Column>
</Grid.Row>
<Grid.Row columns={2}>
<Grid.Column>
<Form.TextArea label="Textarea 3" defaultValue="Lorem Ipsum" disabled readOnly autoHeight />
</Grid.Column>
<Grid.Column>
<Form.TextArea label=" " defaultValue="Lorem Ipsum" disabled readOnly autoHeight />
</Grid.Column>
</Grid.Row>
</Grid>
Under inspect element, the style properties for the TextArea are being set as:
min-height: 0px;
resize: none;
height: 2px;
Where the height: 2px
is obviously wrong.
Version
0.67.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Textarea Auto height [duplicate] - javascript - Stack Overflow
This using Pure JavaScript Code. function auto_grow(element) { element.style.height = "5px"; element.style.height = (element.
Read more >resize - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The resize CSS property sets whether an element is resizable, and if so, ... The element offers no user-controllable method for resizing it....
Read more >The Cleanest Trick for Autogrowing Textareas
/* easy way to plop the elements on top of each other and have them both sized based on the tallest one's height...
Read more >Solved: HTML element - auto-resize a <text area> from a Mu...
I was thinking I could change the height property to "height:auto", but it is doing nothing. At the moment this value is set...
Read more >Make a Textarea Auto Resize to fit Contents - Impressive Webs
A <div> element will naturally stretch to fit the height of its content (assuming no floats or absolutely positioned elements are involved). So ......
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
Version: 0.67.1
I was able to reproduce the problem with AutoHeight when trying to render a Form.TextArea component inside an Accordion.
It looks like this:
When I start typing inside the text area, it will immediately resize to the correct height.
Form.TextArea
renders a form field with a textarea child. The code provided is missing theForm
around theForm.TextArea
. Pasting the above example into the doc site and correcting the markup renders: