Skip to content

Commit 95e18c5

Browse files
committed
fix(multiple): avoid component ID collisions between legacy and non-legacy components
Fixes that the metadata of some of the legacy components was exactly the same as the non-legacy versions which causes a warning to be logged. Fixes #27163.
1 parent d1f1f78 commit 95e18c5

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

src/material/legacy-dialog/testing/dialog-opener.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ import {_MatTestDialogOpenerBase} from '@angular/material/dialog/testing';
2727
template: '',
2828
changeDetection: ChangeDetectionStrategy.OnPush,
2929
encapsulation: ViewEncapsulation.None,
30+
host: {
31+
// This binding is used to ensure that the component ID
32+
// doesn't clash with the `MatTestDialogOpener`.
33+
'[attr.mat-id-collision]': 'null',
34+
},
3035
})
3136
export class MatTestLegacyDialogOpener<T = unknown, R = unknown> extends _MatTestDialogOpenerBase<
3237
MatLegacyDialogContainer,

src/material/legacy-menu/menu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import {
4040
'[attr.aria-labelledby]': 'null',
4141
'[attr.aria-describedby]': 'null',
4242
'ngSkipHydration': '',
43+
// This binding is used to ensure that the component ID doesn't clash with the `MatMenu`.
44+
'[attr.mat-id-collision]': 'null',
4345
},
4446
animations: [matMenuAnimations.transformMenu, matMenuAnimations.fadeInItems],
4547
providers: [{provide: MAT_MENU_PANEL, useExisting: MatLegacyMenu}],

src/material/legacy-table/text-column.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/co
3434
</ng-container>
3535
`,
3636
encapsulation: ViewEncapsulation.None,
37+
host: {
38+
// This binding is used to ensure that the component ID doesn't clash with the `MatTextColumn`.
39+
'[attr.mat-id-collision]': 'null',
40+
},
3741
// Change detection is intentionally not set to OnPush. This component's template will be provided
3842
// to the table to be inserted into its view. This is problematic when change detection runs since
3943
// the bindings in this template will be evaluated _after_ the table's view is evaluated, which

src/material/legacy-tabs/tab.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ import {
3434
encapsulation: ViewEncapsulation.None,
3535
exportAs: 'matTab',
3636
providers: [{provide: MAT_TAB, useExisting: MatLegacyTab}],
37+
host: {
38+
// This binding is used to ensure that the component ID doesn't clash with the `MatTab`.
39+
'[attr.mat-id-collision]': 'null',
40+
},
3741
})
3842
export class MatLegacyTab extends _MatTabBase {
3943
/** Content for the tab label given by `<ng-template mat-tab-label>`. */

src/material/legacy-tooltip/tooltip.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ export class MatLegacyTooltip extends _MatTooltipBase<LegacyTooltipComponent> {
104104
'[style.zoom]': 'isVisible() ? 1 : null',
105105
'(mouseleave)': '_handleMouseLeave($event)',
106106
'aria-hidden': 'true',
107+
// This binding is used to ensure that the component
108+
// ID doesn't clash with the `TooltipComponent`.
109+
'[attr.mat-id-collision]': 'null',
107110
},
108111
})
109112
export class LegacyTooltipComponent extends _TooltipComponentBase {

0 commit comments

Comments
 (0)