-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Label for mat-form-field is overlapping with mat-icon in mat-tab. #26428
Comments
+1, encountering this issue as well while upgrading to angular@15 (from angular@14), temporary workaround I found is using lazy-loaded tabs makes the form input prefix text render as expected <mat-tab label="Example Tab">
<ng-template matTabContent>
<app-example-tab></app-example-tab>
</ng-template>
</mat-tab> |
👍 Still an issue. Encoutered during angular 15 upgrade as well. the workaround that @trentprynn posted seems to get things to display correctly. |
This problem persisting in Angular Material version: 15.2.2 with Angular 15.2.2 The solution that @trentprynn not working for me.
|
As @thomasErich135 mentioned, the issue persists on Angular 15.2.2 Me and my team encountered the exact same issue described by OP. As @trentprynn suggested, lazy loading works. This workaround is not suitable for some cases in our application. |
+1 |
1 similar comment
+1 |
As @spp125 mentioned, the issue with the prefix icon persists on Angular 16.1.0 (material 16.1.3).... Does anyone have a solution/workaround to this problem? |
Is it fixed in latest version? |
Hello, still having the issue on version 16.2.7 |
Persists on Angular 17.0.2 |
Same problem in 17.1.1. The lazy load seem to be a workaround for now. |
For me, the problem was that the icon comes from the network and its size is not known until it is loaded. So when the form field is rendered initially, it doesn't know that my icon is 24x24 since it's not loaded yet. So the code pointed out by @tdahlhoff would find the width of the icon container to be 0. Then when you come back, things look good, because the image is already loaded and cached, so the size is already known. My workaround for this was to hardcode the size of my icon in the CSS. |
Still an issue, using Angular 18 and Material 3, now only available solution seems to be removing the icons |
I have the same issue in v17.3.10, though not in mat-tab but in mat-sidenav. The form is inside a component which is initialized programatically with ViewContainerRef and when the sidenav is closed, therefore outside of viewport, that's when icons overlap. When the sidenav is opened and the component with the form is created, it works fine. |
Is this a regression?
The previous version in which this bug was not present was
14
Description
Label is overlapping with icon.
Reproduction
Steps to reproduce:
add to app.module
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatTabsModule } from '@angular/material/tabs';
add to app.component
for the input field in 2nd tab : label is overlapping with mat-icon
4.
when inspecting the style, it seems the X transform is not correct
Expected Behavior
Label should have correct margin
Actual Behavior
Label is overlapping with mat-icon
Environment
The text was updated successfully, but these errors were encountered: