Skip to content

Commit 1dcc195

Browse files
committed
fix(material/core): ensure that option inherits container background
Fixes that `mat-option` was inheriting its background color from the MDC list which led to issues in M3. The option should always have the same background as its container.
1 parent 2673c68 commit 1dcc195

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/material/core/option/option.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@
5353
}
5454
}
5555

56-
// If the MDC list is loaded after the option, this gets overwritten which breaks the text
57-
// alignment. Ideally we'd wrap all the MDC mixins above with this selector, but the increased
58-
// specificity breaks some internal overrides.
5956
&.mdc-list-item {
57+
// If the MDC list is loaded after the option, this gets overwritten which breaks the text
58+
// alignment. Ideally we'd wrap all the MDC mixins above with this selector, but the increased
59+
// specificity breaks some internal overrides.
6060
align-items: center;
61+
62+
// List items in MDC have a default background color which can be different from the container
63+
// in which the option is projected. Set the base background to transparent since options
64+
// should always have the same color as their container.
65+
background: transparent;
6166
}
6267

6368
// Set the `min-height` here ourselves, instead of going through

0 commit comments

Comments
 (0)