angular / angular/components

perf(cdkTextareaAutosize): Skip height measurements when textarea value is empty

Đang mở
#24,210 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: cdk/text-field G P3
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

Calls to _measureScrollHeight, which trigger css layout, are not needed when there's nothing in the text field. In this case, simply set the height to 1 row (height of one line).

See internal CL 421826236 for more context.

### Reproduction

Steps to reproduce:
1. Bootstrap a textarea with cdkTextareaAutosize that has value of '' (empty)

### Expected Behavior

_measureScrollHeight() called only when there's a non-empty value.

### Actual Behavior

_measureScrollHeight() is called regardless of value.

### Environment

- Angular: 13
- CDK/Material: 13
- Browser(s): All
- Operating System (e.g. Windows, macOS, Ubuntu): All

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu từ phần triển khai cdkTextareaAutosize và lần theo điểm vào _measureScrollHeight bằng một textarea có giá trị rỗng. Xác nhận rằng các giá trị rỗng sử dụng chiều cao một hàng mà không cần đo, trong khi các giá trị không rỗng vẫn giữ nguyên hành vi đo; thêm hoặc cập nhật bài kiểm thử liên quan nếu xác định được vị trí kiểm thử của phần triển khai.

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, performance
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.