Skip to content

Commit 766a01e

Browse files
committed
fix(material-experimental/mdc-list): avoid style conflicts with MDC list
The specificity of the MDC-based menu item is low enough that if the MDC list is loaded later, it'll be overwritten and break the layout of the menu item. These changes increase the specificity of the relevant styles.
1 parent c3bb3a9 commit 766a01e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/material-experimental/mdc-menu/menu.scss

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ mat-menu {
6666
$height-config: map.get(mdc-list-variables.$one-line-item-density-config, height);
6767
min-height: map.get($height-config, default);
6868

69+
// If the MDC list is loaded after the menu, this gets overwritten which breaks the text
70+
// alignment. Ideally we'd wrap all the MDC mixins above with this selector, but the increased
71+
// specificity breaks some internal overrides.
72+
&.mdc-list-item {
73+
align-items: center;
74+
}
75+
6976
&[disabled] {
7077
cursor: default;
7178

@@ -107,6 +114,10 @@ mat-menu {
107114
white-space: normal;
108115
}
109116

117+
&.mat-mdc-menu-item-submenu-trigger {
118+
@include mat.private-menu-common-item-submenu-trigger(mdc-list-variables.$side-padding);
119+
}
120+
110121
@include cdk.high-contrast(active, off) {
111122
$outline-width: 1px;
112123

@@ -122,10 +133,6 @@ mat-menu {
122133
}
123134
}
124135

125-
.mat-mdc-menu-item-submenu-trigger {
126-
@include mat.private-menu-common-item-submenu-trigger(mdc-list-variables.$side-padding);
127-
}
128-
129136
.mat-mdc-menu-submenu-icon {
130137
@include mat.private-menu-common-item-submenu-icon(mdc-list-variables.$side-padding);
131138
}

0 commit comments

Comments
 (0)