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

[TextField] doesn't show all content until edited #7175

Closed
deadbeef404 opened this issue Jun 19, 2017 · 4 comments
Closed

[TextField] doesn't show all content until edited #7175

deadbeef404 opened this issue Jun 19, 2017 · 4 comments
Labels
component: text field This is the name of the generic UI component, not the React module! v0.x

Comments

@deadbeef404
Copy link

I'm not sure if this is a bug or a grey-area in the documentation that needs to be clarified.

In the example linked below, there are four lines of text in the multiline text box, but as rows has been defined as being 1, only one row is entered until the box is edited.

https://www.webpackbin.com/bins/-Kmyge1aQv9GniK0sHMM

I was expecting the text area to be appropriately sized on load to display all the required rows unless the number of rows is greater than rowsMax. I feel that is an reasonable expectation as

  1. it only resizes after you change the content (it doesn't resize on click)
  2. once you click away from the that text area, it doesn't shrink back down.

I think first, I need some clarification on what rows is intended to be. The documentation says Number of rows to display when multiLine option is set to true., but that is an insufficient description as due to the autoresizing functionality, rows seems to be more of a minimum row count.

Is it more accurate to say rows is The minimum number of rows to display when multiLine option is set to true?

I can make a PR to make all the content in the field be displayed on load (I've determined the one-line fix), if that's what is expected.

Versions

  • Material-UI: 0.18.3
  • React: 15.6.1
  • Browser: Chrome, but reading the code indicates it would be an issue on all browsers)
@brendanmh
Copy link

I was about to open an issue for this too.

I see it as a two-line fix, to pass this.props.value to the calls to syncHeightWithShadow in componentDidMount() and handleResize(). Otherwise the code judges the height of the content to be the height of the hint text, which is likely to be one row.

Is that what you had in mind?

@deadbeef404
Copy link
Author

deadbeef404 commented Jun 20, 2017

@brendanmh

pass this.props.value to the calls to syncHeightWithShadow in componentDidMount()

Yes, that's that one I was thinking. I think I'll just make a PR for this change and add a unit test for it.

and handleResize()

I didn't notice that issue, but it definitely is highly related to this one. Would you like to make a PR for that one and add a related unit test?

@damien-monni
Copy link

I am waiting for this to be fixed too.
The workaround I am using now is to set hintText prop only if the textarea value is empty.

@brendanmh
Copy link

#7260

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2022
@zannager zannager added component: text field This is the name of the generic UI component, not the React module! v0.x and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 10, 2023
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! v0.x
Projects
None yet
Development

No branches or pull requests

5 participants