You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(input): incorrect height with autosize (#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#4070.
0 commit comments