-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(autosize): incorrect height with long placeholders #8024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(autosize): incorrect height with long placeholders #8024
Conversation
src/lib/input/autosize.ts
Outdated
@@ -150,14 +150,21 @@ export class MatTextareaAutosize implements AfterViewInit, DoCheck { | |||
return; | |||
} | |||
|
|||
const previousPlaceholder = textarea.placeholder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"previous" isn't exactly right because we're not changing it. How about placeholderText
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/lib/input/autosize.spec.ts
Outdated
|
||
// To be able to trigger a new calculation of the height with a long placeholder, the textarea | ||
// value needs to be changed. | ||
textarea.value = '1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a helper function for this triggerTextareaResize()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@devversion travis is super red |
Long placeholders can cause the `scrollHeight` to be bigger than the actual content is. To ensure the `scrollHeight` is correct, the placeholders need to be removed temporarily. Fixes angular#8013
093769c
to
42fffb2
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Long placeholders can cause the
scrollHeight
to be bigger than the actual content is. To ensure thescrollHeight
is correct, the placeholders need to be removed temporarily.Fixes #8013