Skip to content

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

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

Open
1 task done
mcarriere opened this issue Dec 15, 2022 · 2 comments
Labels
area: material/form-field P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mcarriere
Copy link

mcarriere commented Dec 15, 2022

Is this a regression?

  • 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 <mat-form-field appearance="outline"> containing a <mat-icon matPrefix> inside a <mat-tab> 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

<mat-tab-group>
  <mat-tab label="First">
    <p>
      <mat-form-field appearance="outline">
        <mat-icon matPrefix>search</mat-icon>
        <mat-label>Outline form field</mat-label>
        <input matInput placeholder="Placeholder" />
      </mat-form-field>
    </p>
  </mat-tab>
  <mat-tab label="Second">
    <p>
      <mat-form-field appearance="outline">
        <mat-icon matPrefix>search</mat-icon>
        <mat-label>Outline form field</mat-label>
        <input matInput placeholder="Placeholder" />
      </mat-form-field>
    </p>
  </mat-tab>
</mat-tab-group>

Expected Behavior

The text should be aligned correctly after the icon

Actual Behavior

image

Environment

  • Angular: 15.0.4
  • CDK/Material: 15.0.3
  • Browser(s): Chrome/Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows. MacOS
@mcarriere mcarriere added the needs triage This issue needs to be triaged by the team label Dec 15, 2022
@mcarriere
Copy link
Author

The only difference I could spot was with the

transform: var(--mat-mdc-form-field-label-transform, translateY(-50%) translateX(calc(1 * (52px + var(--mat-mdc-form-field-label-offset-x, 0px))))) !important;

vs

transform: var(--mat-mdc-form-field-label-transform, translateY(-50%) translateX(calc(1 * (0px + var(--mat-mdc-form-field-label-offset-x, 0px))))) !important;

On the .mdc-floating-label

@wagnermaciel wagnermaciel added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/form-field and removed needs triage This issue needs to be triaged by the team labels May 3, 2023
@GuilhermeRabelo
Copy link

any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/form-field P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

3 participants