Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mat-form-field required asterisk has preceding   that fails to collapse with prior whitespace #15489

Open
stevenyxu opened this Issue Mar 14, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@stevenyxu
Copy link
Contributor

stevenyxu commented Mar 14, 2019

What is the expected behavior?

When a <mat-label> has trailing whitespace (e.g., due to a formatter putting </mat-label> on a new line and the template compiler not collapsing whitespace) and the field is required, there should be one space between the label and the asterisk.

84zLDOjNjAY

What is the current behavior?

There are two spaces.

stackblitz

https://stackblitz.com/edit/angular-h3fng3?file=app/form-field-label-example.html

mat-form-field adds &nbsp;* to the label when the field is required.

https://github.com/angular/material2/blob/master/src/lib/form-field/form-field.html#L55

The surrounding .mat-form-field-label already has white-space: nowrap so &nbsp; doesn't serve any additional nowrapping function I know of.

https://github.com/angular/material2/blob/master/src/lib/form-field/form-field.scss#L98

What are the steps to reproduce?

https://stackblitz.com/edit/angular-h3fng3?file=app/form-field-label-example.html

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Current, since at least d6fec35. All browsers in theory, though I haven't tested.

Is there anything else we should know?

I'll send a PR to see how it integrates. It'll likely trivially break many screendiff tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.