angular / angular/components

bug(Form field): mat-error adds spaces to beginning and end when on several lines

未关闭
#26,430 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area: material/form-field P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### 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

When I use mat-error like this:
``
` My Error Message`
``
the resulting string for "My Error Message" has spaces at the beginning and end of it: " My Error Message ".

When I do this:
`My Error Message`
the resulting string is displayed correctly.

### Reproduction

Steps to reproduce:
1. create a mat-error with a line-break and input some dummy text

### Expected Behavior

There shouldn't be spaces inside the mat-error message when it is multi-line.

### Actual Behavior

There are spaces inside the mat-error message when it is multi-line.

### Environment

- CDK/Material: 15.0.4
- Browser(s): Firefox/Chrome
- Operating System Windows

贡献指南

打开贡献指南

调研方向

首先在 Angular Material 中复现多行 mat-error 示例,并跟踪其消息内容的渲染方式。当多行 mat-error 文本不包含开头或结尾的空格,同时单行情况仍能正确显示时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。