bug(cdkTextareaAutosize): Textarea does not size to fit with initial value until window is resized
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện StackBlitz được liên kết và kiểm tra hành vi của directive cdkTextareaAutosize với giá trị ngModel ban đầu và cdkAutosizeMaxRows được đặt thành 5. Xác nhận rằng cả năm dòng đều hiển thị mà không cần thay đổi kích thước cửa sổ và không xuất hiện thanh cuộn, phù hợp với hành vi mong đợi được mô tả trong issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100