Skip to content

bug(mat-form-field): label is not within the border gap for outline appearance #23863

Closed
@sbrunecker

Description

@sbrunecker

Reproduction

https://stackblitz.com/edit/components-issue-jbhqbn

image

Modify the initial value of countryCode in src/app/example-component.ts to see that the gap is moving based on the initial prefix length (e.g. "" and "+12345").

image
image

Now changing the country to USA:

image

Expected Behavior

When the input is focused, the label and the gap in the outline are properly aligned in the upper left corner.

Actual Behavior

The gap is placed based on the initial prefix while the label is placed based on the current prefix so if the initial prefix length is not the same as the current prefix length, the label will appear misaligned.

Environment

  • Angular: 12.2.9
  • CDK/Material: 12.2.9
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/form-field

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions