-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
bug(cdkTextareaAutosize): cdkTextareaAutosize does not resize when the placeholder or label is long #22042
Comments
It sounds reasonable to me, considering that the placeholder wraps on My concern is how we would handle the case where the placeholder is longer than the value. Would the height collapse when the user focuses the input and the placeholder disappears? It might also be weird if there's a short value with a long placeholder where clearing the input would cause the |
I am thinking that whatever minimizes movement might make the most sense, so if the placeholder is long and the data is small we shouldn't necessarily snap back to a smaller size as soon as the user begins editing |
Maybe we should just never let the textarea get smaller than the height with the placeholder. I'm not sure it really makes sense to let it go smaller |
My inclination would also be to make this an option that's probably off by default in order to avoid breaking layouts in existing apps. |
I would prefer not to have it be an option, just because it adds complexity. Depending on how its implemented, I'm fairly confident it won't break too many people. We could at least try a presubmit and see how it goes |
That's reasonable, we can see what the presubmit shows and go from there |
Is this currently being worked on? It is important for a launch we have coming up so I am trying to evaluate if we need to implement our own hacky fix or if the official fix will land first |
I don't think anyone has picked it up yet- if you wanted to take a pass at a PR I think the code would be pretty straightforward. Otherwise I can see if someone pon the team has time to take a look in the next week. |
I will take a look at making a PR for this today |
I was successful in implementing this within g3, I will work now on creating a PR which follows all of the various guidelines for GH and do a GTP |
My attempted PR didn't work for this. I has been indicated to me that someone on the Angular team will take a look at this soon |
Fixes a bug with CdkTextareaAutosize where the textarea would not be autosized when using long placeholders Fixes #22042 Cache the height with the placeholder do calculation better fix comment Stop caching the placeholder because I can't make the caching approach work with view-engine go back to the caching approach Account for the input tests fix lint error
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. |
Reproduction
https://stackblitz.com/edit/angular-2ebx1r?file=src/app/./text-field-autosize-textarea-example.html
Expected Behavior
What behavior were you expecting to see?
When a textarea has a long placeholder or label and the textarea using cdkTextareaAutosize, the text area should be auto-sized to support the length of the placeholder
Actual Behavior
What behavior did you actually see?
The text area does not auto-size to the placeholder or label used, and instead stays at the min number of rows and shows an internal (scrollbar?) the scroll through the placeholder
Environment
The text was updated successfully, but these errors were encountered: