Skip to content

Commit

Permalink
fix(list): disable hover styling on touch devices (#12520)
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto authored and josephperrott committed Aug 7, 2018
1 parent 7dff5f8 commit 795c956
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/lib/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ $mat-list-item-inset-divider-offset: 72px;
.mat-list, .mat-nav-list, .mat-selection-list {
padding-top: $mat-list-top-padding;
display: block;
-webkit-tap-highlight-color: transparent;

.mat-subheader {
@include mat-subheader-spacing($mat-list-top-padding, $mat-list-base-height);
Expand All @@ -228,8 +229,9 @@ $mat-list-item-inset-divider-offset: 72px;
}


.mat-list[dense], .mat-nav-list[dense], .mat-selection-list[dense] {

.mat-list[dense],
.mat-nav-list[dense],
.mat-selection-list[dense] {
padding-top: $mat-dense-top-padding;
display: block;

Expand Down Expand Up @@ -266,3 +268,16 @@ $mat-list-item-inset-divider-offset: 72px;
cursor: pointer;
outline: none;
}


// Disable the hover styles on non-hover devices. Since this is more of a progressive
// enhancement and not all desktop browsers support this kind of media query, we can't
// use something like `@media (hover)`.
@media (hover: none) {
.mat-list-option,
.mat-nav-list .mat-list-item {
&:hover {
background: none;
}
}
}

0 comments on commit 795c956

Please sign in to comment.