angular / angular/components

bug(mat-list): Bad symmetry on text when line-break in code

Đang mở
#26,657 0 bình luận 5 reaction 0 người được giao Xem trên GitHub
area: material/list 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?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

v14

### Description

The text in both matListItemTitle and matListItemLine creates a whitespace at the start and end of the text when the code is broken over multiple lines. This breaks the symmetry of the list items as seen in this example on the docs page
![image](https://user-images.githubusercontent.com/3032384/220096686-6c734818-a024-42af-8536-fee6da3ccad8.png)

### Reproduction

Stackblitz of the issue already showing in the docs page:
https://stackblitz.com/run?file=src%2Fapp%2Flist-variants-example.ts

Works:
`Text`

Creates extra spacing:
```

Text

```

### Expected Behavior

Expect the result not to have white spaces when rendered, or to ignore the white spaces. As it worked in v14.

### Actual Behavior

Gets an extra white space when the code has line break inside tag. Breaks symmetry

### Environment

- Angular: latest v15
- CDK/Material: latest v15
- 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 với bản tái hiện trên StackBlitz, đặc biệt là src/app/list-variants-example.ts, và so sánh markup matListItemTitle và matListItemLine được render với nội dung span inline và nhiều dòng. Truy vết phần triển khai list liên quan của Angular Material từ bản tái hiện và xác minh rằng markup nhiều dòng được render mà không có khoảng trắng ở đầu hoặc cuối, đồng thời giữ nguyên tính đối xứng của các list-item.

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

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.