@@ -18,8 +18,10 @@ mat-menu {
1818 @include mdc-list-mixins .list-base ($query : structure);
1919
2020 & ,
21- .mat-mdc-menu-item .mdc-list-item__primary -text {
21+ .mat-mdc-menu-item .mat- mdc-menu-item -text {
2222 @include mdc-typography .smooth-font ();
23+ white-space : normal ;
24+
2325 @include token-utils .use-tokens (tokens-mat-menu .$prefix , tokens-mat-menu .get-token-slots ()) {
2426 @include token-utils .create-token-slot (font-family , item- label- text- font);
2527 @include token-utils .create-token-slot (line-height , item- label- text- line- height);
@@ -32,7 +34,8 @@ mat-menu {
3234
3335.mat-mdc-menu-panel {
3436 @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 ;
3639 box-sizing : border-box ;
3740 outline : 0 ;
3841
@@ -63,20 +66,6 @@ mat-menu {
6366 }
6467}
6568
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-
8069.mat-mdc-menu-item {
8170 @include mdc-helpers .disable-mdc-fallback-declarations {
8271 @include mdc-list-mixins .item-base ;
@@ -96,6 +85,7 @@ mat-menu {
9685 background : none ;
9786 text-decoration : none ;
9887 margin : 0 ; // Resolves an issue where buttons have an extra 2px margin on Safari.
88+ align-items : center ;
9989
10090 // Set the `min-height` here ourselves, instead of going through
10191 // the `mdc-list-one-line-item-density` mixin, because it sets a `height`
@@ -117,13 +107,6 @@ mat-menu {
117107 }
118108 }
119109
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-
127110 & [disabled ] {
128111 cursor : default ;
129112
@@ -159,12 +142,6 @@ mat-menu {
159142 }
160143 }
161144
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-
168145 & .mat-mdc-menu-item-submenu-trigger {
169146 @include menu-common .item-submenu-trigger (mdc-list-variables .$side-padding );
170147 }
0 commit comments