Skip to content

Commit d056f98

Browse files
authored
fix(material/paginator): button icons blending in with background in high contrast mode on Chromium browsers (#22385)
Setting `fill: currentColor` on an SVG element causes it to blend in with the background on Chromium-based browsers. These changes add a fallback color.
1 parent 5e42d15 commit d056f98

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/material-experimental/mdc-paginator/paginator.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ $button-icon-size: 28px;
8888
.mat-mdc-icon-button[disabled] .mat-mdc-paginator-icon,
8989
.mat-mdc-paginator-icon {
9090
fill: currentColor;
91+
92+
// On Chromium browsers the `currentColor` blends in with the
93+
// background for SVGs so we have to fall back to `CanvasText`.
94+
fill: CanvasText;
9195
}
9296

9397
.mat-mdc-paginator-range-actions .mat-mdc-icon-button {

src/material/paginator/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ sass_library(
4242
sass_binary(
4343
name = "paginator_scss",
4444
src = "paginator.scss",
45+
deps = [
46+
"//src/cdk/a11y:a11y_scss_lib",
47+
],
4548
)
4649

4750
ng_test_library(

src/material/paginator/paginator.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use '../../cdk/a11y/a11y';
2+
13
$padding: 0 8px;
24
$page-size-margin-right: 8px;
35

@@ -73,4 +75,10 @@ $button-icon-size: 28px;
7375
[dir='rtl'] & {
7476
transform: rotate(180deg);
7577
}
78+
79+
@include a11y.high-contrast(active, off) {
80+
// On Chromium browsers the `currentColor` blends in with the
81+
// background for SVGs so we have to fall back to `CanvasText`.
82+
fill: CanvasText;
83+
}
7684
}

0 commit comments

Comments
 (0)