angular / angular/components

bug(mat-form-field): mat-form-field appearance outline with mat-icon as matPrefix inside a mat-tab

Open
#26,271 2 comments 8 reactions 0 assignees View on GitHub
area: material/form-field P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

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

13

### Description

If we have a `` containing a `` inside a `` that is not displayed initially, the label isn't positioned correctly.

### Reproduction

Steps to reproduce:

https://stackblitz.com/edit/angular-ivy-svduwe?file=src%2Fapp%2Fapp.component.html,angular.json,src%2Fstyles.scss,src%2Fapp%2Fapp.module.ts,src%2Findex.html

```




search
Outline form field







search
Outline form field



```

### Expected Behavior

The text should be aligned correctly after the icon

### Actual Behavior

![image](https://user-images.githubusercontent.com/25467653/207881998-8d73d9a7-147c-46b6-95cc-99fd76acd432.png)

### Environment

- Angular: 15.0.4
- CDK/Material: 15.0.3
- Browser(s): Chrome/Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows. MacOS

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction, especially src/app/app.component.html and the referenced angular.json, src/styles.scss, src/app/app.module.ts, and src/index.html files. Reproduce the outline mat-form-field with a mat-icon matPrefix in the initially hidden mat-tab, then trace the Angular Material form-field and tab behavior; done means the label and text align correctly after switching tabs.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.