material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Text Field] multiline support doesn't work when the component is initially hidden and then revealed

Open dehjli85 opened this issue 9 years ago • 3 comments

Problem description

If the TextField is part of a div that is hidden (i.e. css - display: none), and then later revealed (i.e. css - display: block), the multiline support doesn't work until the user clicks on the component and edits the text. Then it behaves as normal. Issue is reproduced in the link below.

Link to minimal working code that reproduces the issue

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

Versions

  • Material-UI: 0.18
  • React: 15.4.2
  • Browser: Chrome

dehjli85 avatar May 11 '17 04:05 dehjli85

        {
            (this.state.hidden) ? 
                null :
                <TextField
                  errorText=""
                  floatingLabelText="Some floating label"
                  floatingLabelFixed={true}
                  multiLine={true}
                  value = "ajhsdbhjasbdjhabsjhdbjas djhas djas jhd asjhd j"
                />

        }

Try this.

sajal50 avatar May 27 '17 06:05 sajal50

Note, the webpackbin reference above was throwing an error when I visited it, I've reproduced the example here: https://www.webpackbin.com/bins/-Kmyb3oPuT3eEuA20grR

EDIT: More info: syncHeightWithShadow uses shadow.scrollHeight to ask the real hidden textarea what its height should be. Unfortunately, when wrapped in a div that has display: none, shadow.scrollHeight returns 0.

Just adding info because I'm facing a similar but unrelated issue and did some investigation.

deadbeef404 avatar Jun 19 '17 04:06 deadbeef404

We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. While we haven't tested it, I think that the issue is most likely fixed on that branch. Hence, I'm closing it. Still, we will accept PR fixes until v1-beta takes over the master branch.

oliviertassinari avatar Aug 24 '17 20:08 oliviertassinari