forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(input): incorrect height with autosize (angular#4084)
Currently when using the `mdTextareaAutosize` directive the textarea height might be incorrect on component initialization. This happens because the textarea `scrollHeight` property is not ready in the `ngOnInit` lifecycle hook yet. Other libraries like `angular-elastic` have timeouts for that. But using the `ngAfterViewInit` lifecycle hook is more elegant and also ensures that the `scrollHeight` property is ready. Also switches `offsetHeight` to `clientHeight` since we don't want to include the border in our line-height calculations. Also by default `textarea` elements have a padding of `2px` and the `padding` needs to be explicitly set to `0px` when resolving the line-height. Fixes angular#4070.
- Loading branch information
1 parent
efb39da
commit 21f8899
Showing
2 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters