Skip to content

refactor(material/list): fix action list CSS styles conflict with MDC-based list #20477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/material-experimental/mdc-list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@
display: block;
}

// Remove the browser button appearance for action list button items. These
// buttons should appear as if they were standard Material Design list items.
.mat-mdc-action-list button.mdc-list-item {
background: none;
color: inherit;
border: none;
font: inherit;
outline: inherit;
-webkit-tap-highlight-color: transparent;
// Set the text alignment to "start" as buttons align their content
// centered by default. List content is aligned on the start.
text-align: left;

[dir='rtl'] & {
text-align: right;
}

&::-moz-focus-inner {
border: 0;
}
}

// MDC expects that the list items are always `<li>`, since we actually use `<button>` in some
// cases, we need to make sure it expands to fill the available width.
.mat-mdc-list-item,
Expand Down
4 changes: 3 additions & 1 deletion src/material/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ $item-inset-divider-offset: 72px;
}
}

mat-action-list {
.mat-action-list {
// Remove the native button look and make it look like a list item
button {
background: none;
Expand All @@ -277,6 +277,8 @@ mat-action-list {
font: inherit;
outline: inherit;
-webkit-tap-highlight-color: transparent;
// Set the text alignment to "start" as buttons align their content
// centered by default. List content is aligned on the start.
text-align: left;

[dir='rtl'] & {
Expand Down