bug(cdkTextareaAutosize): Textarea does not size to fit with initial value until window is resized
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
Auto resize of the cdkTextareaAutosize directive for a textarea, which has an initial value bound to it, is not working.
### Reproduction
It is a fork of the "Auto-resizing textarea" example of https://material.angular.io/cdk/text-field/overview. I have just added ngModel with a initial value of 5 lines. This 5 lines should be displayed without scrolling (cdkAutosizeMaxRows is also set to 5).
StackBlitz link: https://stackblitz.com/edit/oktcnmdj
Steps to reproduce:
1. Start example
### Expected Behavior
Textarea should immediatly show all 5 lines without scrollbar, without resizing the window.
### Actual Behavior
Scrollbar is shown and only 3 lines are displayed
After resizing the window it works.
### Environment
- Angular: 19.2.3
- CDK/Material: 19.2.3
- Browser(s): chrome 134.0.6998.89
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
Guía de contribución
Línea de trabajo
Comienza ejecutando la reproducción enlazada en StackBlitz e inspecciona el comportamiento de la directiva cdkTextareaAutosize con un valor inicial de ngModel y cdkAutosizeMaxRows establecido en 5. Confirma que las cinco líneas se muestran sin cambiar el tamaño de la ventana y que no aparece ninguna barra de desplazamiento, de acuerdo con el comportamiento esperado descrito en el issue.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100