|
14 | 14 | background: $active-base-color;
|
15 | 15 | }
|
16 | 16 |
|
17 |
| - &.mdc-list-item--selected::before { |
18 |
| - background: $selected-color; |
19 |
| - opacity: mdc-ripple.states-opacity($selected-color, selected); |
| 17 | + &:not(:focus):not(.mdc-list-item--disabled):hover::before { |
| 18 | + opacity: mdc-ripple.states-opacity($active-base-color, hover); |
20 | 19 | }
|
21 | 20 |
|
22 |
| - &:focus::before { |
23 |
| - opacity: mdc-ripple.states-opacity($active-base-color, focus); |
| 21 | + &.mdc-list-item--selected { |
| 22 | + &::before { |
| 23 | + background: $selected-color; |
| 24 | + opacity: mdc-ripple.states-opacity($selected-color, selected); |
| 25 | + } |
| 26 | + |
| 27 | + &:not(:focus):not(.mdc-list-item--disabled):hover::before { |
| 28 | + // The hover and selected opacities need to be combined to match with what the MDC |
| 29 | + // ripple state would render. More details here: |
| 30 | + // https://github.com/material-components/material-components-web/blob/348665978ce73694ad4518626dd70cdf5b984113/packages/mdc-ripple/_ripple-theme.scss#L450. |
| 31 | + opacity: mdc-ripple.states-opacity($selected-color, hover) + |
| 32 | + mdc-ripple.states-opacity($selected-color, selected); |
| 33 | + } |
24 | 34 | }
|
25 |
| - } |
26 | 35 |
|
27 |
| - // MDC still shows focus/selected state if the item is disabled. |
28 |
| - // Just hover styles should not show up for disabled items. |
29 |
| - .mat-mdc-list-item-interactive:not(.mdc-list-item--disabled):not(.mdc-list-item--selected) { |
30 |
| - &:not(:focus):hover::before { |
31 |
| - opacity: mdc-ripple.states-opacity($active-base-color, hover); |
| 36 | + &:focus::before { |
| 37 | + opacity: mdc-ripple.states-opacity($active-base-color, focus); |
32 | 38 | }
|
33 | 39 | }
|
34 | 40 | }
|
0 commit comments