Skip to content

Commit 49e60ac

Browse files
authored
fix(material/tabs): coloring issues when a backgroundColor is set (#22612)
Resolves several issues related to the color of icons and ripples in the tab header, when it has a non-default `backgroundColor`. Fixes #22587.
1 parent b847535 commit 49e60ac

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/material-experimental/mdc-tabs/_tabs-common.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,11 @@ $mat-tab-animation-duration: 500ms !default;
129129
.mat-mdc-tab-header-pagination-disabled {
130130
box-shadow: none;
131131
cursor: default;
132-
opacity: 0.4;
133132
pointer-events: none;
133+
134+
.mat-mdc-tab-header-pagination-chevron {
135+
opacity: 0.4;
136+
}
134137
}
135138

136139
.mat-mdc-tab-list {

src/material-experimental/mdc-tabs/_tabs-theme.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,19 @@
7777
@include mdc-theme.prop(color, $foreground-color);
7878
}
7979

80+
.mdc-tab-indicator__content--underline,
81+
.mat-mdc-tab-header-pagination-chevron,
82+
.mat-mdc-focus-indicator::before {
83+
@include mdc-theme.prop(border-color, $foreground-color);
84+
}
85+
}
86+
87+
> .mat-mdc-tab-header, > .mat-mdc-tab-link-container, > .mat-mdc-tab-header-pagination {
8088
.mat-ripple-element, .mdc-tab__ripple::before {
8189
@include mdc-theme.prop(background-color, $foreground-color);
8290
}
8391

84-
.mdc-tab-indicator__content--underline, .mat-mdc-tab-header-pagination-chevron,
85-
.mat-mdc-focus-indicator::before,
86-
.mat-mdc-focus-indicator::before {
92+
.mat-mdc-tab-header-pagination-chevron {
8793
@include mdc-theme.prop(border-color, $foreground-color);
8894
}
8995
}

src/material-experimental/mdc-tabs/tab-header.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
@include tabs-common.paginated-tab-header-container;
1010
}
1111

12-
.mat-mdc-tab-header-pagination-disabled {
13-
box-shadow: none;
14-
cursor: default;
15-
opacity: 0.4;
16-
}
17-
1812
.mat-mdc-tab-labels {
1913
@include tabs-common.paginated-tab-header-item-wrapper('.mat-mdc-tab-header');
2014
}

src/material/tabs/_tabs-theme.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,23 @@
117117
}
118118

119119
// Set pagination chevrons to contrast background
120+
> .mat-tab-header .mat-tab-header-pagination-chevron,
120121
> .mat-tab-header-pagination .mat-tab-header-pagination-chevron,
121-
> .mat-tab-links .mat-focus-indicator::before,
122+
> .mat-tab-link-container .mat-focus-indicator::before,
122123
> .mat-tab-header .mat-focus-indicator::before {
123124
border-color: theming.get-color-from-palette($background-color, default-contrast);
124125
}
125126

127+
> .mat-tab-header .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron,
126128
> .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
127129
border-color: theming.get-color-from-palette($background-color, default-contrast, 0.4);
128130
}
129131

130132
// Set ripples color to be the contrast color of the new background. Otherwise the ripple
131133
// color will be based on the app background color.
132134
> .mat-tab-header .mat-ripple-element,
133-
> .mat-tab-link-container .mat-ripple-element {
135+
> .mat-tab-link-container .mat-ripple-element,
136+
> .mat-tab-header-pagination .mat-ripple-element {
134137
background-color: theming.get-color-from-palette($background-color, default-contrast, 0.12);
135138
}
136139
}

0 commit comments

Comments
 (0)