Material: Bug: md-input-container textarea max-height/rows limitation problem

Created on 23 Mar 2015  Â·  10Comments  Â·  Source: angular/material

Is there a way to limit a size of textarea with help "rows" attribute or similar?

<md-input-container>
  <label>Text</label>
  <textarea ng-model="feedback" rows="3"></textarea>
</md-input-container>
fixed bug

Most helpful comment

<textarea md-detect-hidden> fixes the issue for me…

All 10 comments

+1

+1

+1

+1

Besides that, when the textarea is too height, when your text is down the page, it autoscroll to top, being impossible to see what you are writing. Don't know if it will be acomplished in the same scope.

I have code something like this:

<md-input-container id="message" class="md-block" flex-gt-sm>
              <label>Message</label>
                  <textarea required
                            rows="10"
                            placeholder="Your message to support here"
                            ng-model="vm.email.message"
                            name="message"></textarea>
              <div ng-messages="emailSendForm.message.$error">
                <div ng-message="required">This is required.</div>
              </div>
            </md-input-container>

But still, render rows ="1" in the source ! my version: "angular-material": "1.0.9"

+1

@almothafar I reproduced your problem, I found this line that is executed after the textarea initialization,
https://github.com/angular/material/blob/master/src/components/input/input.js#L471
It's weird, But I added the md-no-autogrow directive to avoid call the grow function and it's works for me.

<textarea md-detect-hidden> fixes the issue for me…

That directive is documented here at the bottom, it's disabled by default for performance reasons: https://material.angularjs.org/latest/api/directive/mdInput#attributes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeoLozes picture LeoLozes  Â·  3Comments

PeerInfinity picture PeerInfinity  Â·  3Comments

epelc picture epelc  Â·  3Comments

chriseyhorn picture chriseyhorn  Â·  3Comments

diogodomanski picture diogodomanski  Â·  3Comments