Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 7fe6f87

Browse files
devversionThomasBurleson
authored andcommitted
fix(input): textarea auto grow fixed
* Textarea should grow automatically if no `rows` attribute is specified. * Texarea should stay fixed with given `rows` attribute (no growing or shrinking) Fixes #5627. Closes #5636.
1 parent ab0ffc4 commit 7fe6f87

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/components/input/demoBasicUsage/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
<md-input-container class="md-block">
7979
<label>Biography</label>
80-
<textarea ng-model="user.biography" columns="1" md-maxlength="150"></textarea>
80+
<textarea ng-model="user.biography" columns="1" md-maxlength="150" rows="5"></textarea>
8181
</md-input-container>
8282

8383

src/components/input/input.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ function inputTextareaDirective($mdUtil, $window, $mdAria) {
322322
node.style.minHeight = null;
323323
}
324324

325-
var rows = Math.max(min_rows, Math.round(node.scrollHeight / lineHeight));
325+
var rows = Math.min(min_rows, Math.round(node.scrollHeight / lineHeight));
326326
node.setAttribute("rows", rows);
327+
node.style.height = lineHeight * rows + "px";
327328
}
328329

329330
// reset everything back to normal

0 commit comments

Comments
 (0)