Skip to content
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

Textarea initial height being set to zero #1870

Closed
matsilva opened this issue Oct 13, 2015 · 6 comments
Closed

Textarea initial height being set to zero #1870

matsilva opened this issue Oct 13, 2015 · 6 comments
Labels
component: text field This is the name of the generic UI component, not the React module!

Comments

@matsilva
Copy link
Contributor

After _syncHeightWithShadow is called on componentDidMount in the enhanced-textarea.jsx component, it will revert from initial 24 value to 0. As a result, the user is completely blocked from editing the textarea.

I managed to temporarily fix it by changing this line:
https://github.com/callemall/material-ui/blob/master/src/enhanced-textarea.jsx#L123

To:

if (this.state.height !== newHeight && newHeight !== 0) {

Before the fix
screen shot 2015-10-13 at 4 45 26 pm

After the fix*
screen shot 2015-10-13 at 4 47 15 pm

@oliviertassinari
Copy link
Member

Regarding the fix. What about using instead a max function on the newHeight and rowsHeight?
PR are welcomed.
What props do you pass to the component to produce this bug?

@matsilva
Copy link
Contributor Author

Cool I can whip together a PR tomorrow.

Just to clarify, you'd be cool with something like this?

newHeight = Math.max(newHeight, rowsHeight)

Here is the component I used to produce the issue using version 0.12.3 of material-ui.

<TextField
    underlineFocusStyle={underlineStyle}
    className="template-upload-field"
        ref="description"
        onBlur={this.addDetails.bind(this, "description")}
    fullWidth={true}
    multiLine={true}
    hintText="Add a description" />

@oliviertassinari
Copy link
Member

Yes exactly. I think that the multiLine is a dead property. I don't understand what is reponsible for this strange behaviour.

@matsilva
Copy link
Contributor Author

Submitted PR for this issue, please review: #1875

@matsilva
Copy link
Contributor Author

I feel like I should dig into this more though to understand the behaviour... but I need to get something working in the meantime...

@matsilva
Copy link
Contributor Author

@oliviertassinari pretty backed up on PRs huh? I got another pull request I want to add for documenting certain props of the select field.

Do you guys need any help in the PR department?

@zannager zannager added the component: text field This is the name of the generic UI component, not the React module! label Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

3 participants