bug(cdkTextareaAutosize): Textarea does not size to fit with initial value until window is resized
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
### 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
Beitragsleitfaden
Rechercherichtung
Beginne damit, die verlinkte StackBlitz-Reproduktion auszuführen, und untersuche das Verhalten der cdkTextareaAutosize-Direktive mit einem initialen ngModel-Wert und cdkAutosizeMaxRows auf 5 gesetzt. Bestätige, dass alle fünf Zeilen ohne eine Größenänderung des Fensters angezeigt werden und kein Scrollbalken erscheint, entsprechend dem im Issue beschriebenen erwarteten Verhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100