Skip to content

Commit 01d5a9d

Browse files
authored
fix(multiple): remove touch tap highlights (#26073)
Removes the touchscreen device tap highlights from the various components where we have similar indication. Fixes #26068.
1 parent 3fb1fbc commit 01d5a9d

File tree

8 files changed

+16
-6
lines changed

8 files changed

+16
-6
lines changed

src/material/button/_button-base.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// ripple and state container so that they fill the button, match the border radius, and avoid
1111
// pointer events.
1212
@mixin mat-private-button-interactive() {
13+
-webkit-tap-highlight-color: transparent;
14+
1315
// The ripple container should match the bounds of the entire button.
1416
.mat-mdc-button-ripple,
1517
.mat-mdc-button-persistent-ripple,

src/material/checkbox/checkbox.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
// Avoids issues in some CSS grid layouts (see #25153).
3232
position: relative;
33+
-webkit-tap-highlight-color: transparent;
3334

3435
.mdc-checkbox {
3536
// MDC theme styles also include structural styles so we have to include the theme at least

src/material/chips/chip.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
}
6060

6161
.mat-mdc-standard-chip {
62+
-webkit-tap-highlight-color: transparent;
63+
6264
@include mdc-helpers.disable-mdc-fallback-declarations {
6365
@include mdc-chip-theme.theme-styles((
6466
// Static tokens

src/material/core/option/option.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
mdc-list-variables.$side-padding, $query: mdc-helpers.$mdc-base-styles-query);
1515
@include vendor-prefixes.user-select(none);
1616
cursor: pointer;
17+
-webkit-tap-highlight-color: transparent;
1718

1819
// If the MDC list is loaded after the option, this gets overwritten which breaks the text
1920
// alignment. Ideally we'd wrap all the MDC mixins above with this selector, but the increased

src/material/list/list.scss

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ a.mdc-list-item--activated {
2727
}
2828
}
2929

30-
// MDC expects that the list items are always `<li>`, since we actually use `<button>` in some
31-
// cases, we need to make sure it expands to fill the available width.
3230
.mat-mdc-list-item,
3331
.mat-mdc-list-option {
32+
// MDC expects that the list items are always `<li>`, since we actually use `<button>` in some
33+
// cases, we need to make sure it expands to fill the available width.
3434
width: 100%;
3535
box-sizing: border-box;
36+
-webkit-tap-highlight-color: transparent;
3637

3738
// MDC always sets the cursor to `pointer`. We do not want to show this for non-interactive
3839
// lists. See: https://github.com/material-components/material-components-web/issues/6443
@@ -41,10 +42,8 @@ a.mdc-list-item--activated {
4142
}
4243
}
4344

44-
// MDC doesn't have list dividers, so we use mat-divider and style appropriately.
45-
// TODO(devversion): check if we can use the MDC dividers.
46-
.mat-mdc-list-item,
47-
.mat-mdc-list-option {
45+
// MDC doesn't have list dividers, so we use mat-divider and style appropriately.
46+
// TODO(devversion): check if we can use the MDC dividers.
4847
.mat-divider-inset {
4948
position: absolute;
5049
left: 0;

src/material/radio/radio.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
}
1616

1717
.mat-mdc-radio-button {
18+
-webkit-tap-highlight-color: transparent;
19+
1820
.mdc-radio {
1921
// MDC theme styles also include structural styles so we have to include the theme at least
2022
// once here. The values will be overwritten by our own theme file afterwards.

src/material/slide-toggle/slide-toggle.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
.mat-mdc-slide-toggle {
1717
display: inline-block;
18+
-webkit-tap-highlight-color: transparent;
1819

1920
// Remove the native outline since we use the ripple for focus indication.
2021
outline: 0;

src/material/tabs/_tabs-common.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ $mat-tab-animation-duration: 500ms !default;
2626
}
2727

2828
@mixin tab {
29+
-webkit-tap-highlight-color: transparent;
30+
2931
&.mdc-tab {
3032
// This is usually included by MDC's tab bar, however we don't
3133
// use it because we implement our own pagination.

0 commit comments

Comments
 (0)