bug(cdkTextareaAutosize): Textarea does not size to fit with initial value until window is resized
- Langage dominant
- TypeScript
- Étoiles
- 25k
- Forks
- 6.8k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 91
Description
### 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
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par exécuter la reproduction StackBlitz liée et inspectez le comportement de la directive cdkTextareaAutosize avec une valeur initiale de ngModel et cdkAutosizeMaxRows défini sur 5. Confirmez que les cinq lignes s'affichent sans redimensionnement de la fenêtre et qu'aucune barre de défilement n'apparaît, conformément au comportement attendu décrit dans l'issue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- frontend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100