@@ -18,8 +18,10 @@ mat-menu {
18
18
@include mdc-list-mixins .list-base ($query : structure);
19
19
20
20
& ,
21
- .mat-mdc-menu-item .mdc-list-item__primary -text {
21
+ .mat-mdc-menu-item .mat- mdc-menu-item -text {
22
22
@include mdc-typography .smooth-font ();
23
+ white-space : normal ;
24
+
23
25
@include token-utils .use-tokens (tokens-mat-menu .$prefix , tokens-mat-menu .get-token-slots ()) {
24
26
@include token-utils .create-token-slot (font-family , item- label- text- font);
25
27
@include token-utils .create-token-slot (line-height , item- label- text- line- height);
@@ -32,7 +34,8 @@ mat-menu {
32
34
33
35
.mat-mdc-menu-panel {
34
36
@include token-utils .create-token-values (tokens-mat-menu .$prefix ,
35
- tokens-mat-menu .get-unthemable-tokens ());
37
+ tokens-mat-menu .get-unthemable-tokens ());
38
+ @include menu-common .base ;
36
39
box-sizing : border-box ;
37
40
outline : 0 ;
38
41
@@ -63,20 +66,6 @@ mat-menu {
63
66
}
64
67
}
65
68
66
- // We need to increase the specificity for these styles to ensure we are not overridden by MDC's
67
- // .mdc-menu-surface styles. This can happen if the MDC styles are loaded in after our styles.
68
- .mat-mdc-menu-panel.mat-mdc-menu-panel {
69
- // Include Material's base menu panel styling which contain the `min-width`, `max-width` and some
70
- // styling to make scrolling smoother. MDC doesn't include the `min-width` and `max-width`, even
71
- // though they're explicitly defined in spec.
72
- @include menu-common .base ;
73
-
74
- // The CDK positioning uses flexbox to anchor the element, whereas MDC uses `position: absolute`.
75
- // Furthermore, the relative position ensures that the `offsetParent` is the menu, rather than
76
- // the overlay. This comes into play when we measure the `offsetTop` of a menu item.
77
- position : relative ;
78
- }
79
-
80
69
.mat-mdc-menu-item {
81
70
@include mdc-helpers .disable-mdc-fallback-declarations {
82
71
@include mdc-list-mixins .item-base ;
@@ -96,6 +85,7 @@ mat-menu {
96
85
background : none ;
97
86
text-decoration : none ;
98
87
margin : 0 ; // Resolves an issue where buttons have an extra 2px margin on Safari.
88
+ align-items : center ;
99
89
100
90
// Set the `min-height` here ourselves, instead of going through
101
91
// the `mdc-list-one-line-item-density` mixin, because it sets a `height`
@@ -117,13 +107,6 @@ mat-menu {
117
107
}
118
108
}
119
109
120
- // If the MDC list is loaded after the menu, this gets overwritten which breaks the text
121
- // alignment. Ideally we'd wrap all the MDC mixins above with this selector, but the increased
122
- // specificity breaks some internal overrides.
123
- & .mdc-list-item {
124
- align-items : center ;
125
- }
126
-
127
110
& [disabled ] {
128
111
cursor : default ;
129
112
@@ -159,12 +142,6 @@ mat-menu {
159
142
}
160
143
}
161
144
162
- // Needs to be overwritten explicitly, because the style can
163
- // leak in from the list and cause the text to truncate.
164
- .mdc-list-item__primary-text {
165
- white-space : normal ;
166
- }
167
-
168
145
& .mat-mdc-menu-item-submenu-trigger {
169
146
@include menu-common .item-submenu-trigger (mdc-list-variables .$side-padding );
170
147
}
0 commit comments