Skip to content

Commit bbb11ae

Browse files
committed
fix(form-field): placeholder not hiding if -webkit-text-fill-color is used
If developers use `-webkit-text-fill-color` to change the color of the placeholder and label, the actual "native" placeholder won't be invisible because `-webkit-text-fill-color` overwrites `color: transparent`. Fixes #12074
1 parent 89cad3f commit bbb11ae

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/lib/input/input.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
// input color in IE, if the consumer overrides it with a higher specificity.
7676
color: transparent !important;
7777

78+
// Overwrite browser specific CSS properties that can overwrite the `color` property.
79+
// Some developers seem to use this approach to easily overwrite the placeholder and
80+
// label color. See: https://github.com/angular/material2/issues/12074
81+
-webkit-text-fill-color: transparent;
82+
7883
// Remove the transition to prevent the placeholder
7984
// from overlapping when the label comes back down.
8085
transition: none;

src/lib/select/select.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ $mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-a
112112
.mat-form-field-hide-placeholder & {
113113
color: transparent;
114114

115+
// Overwrite browser specific CSS properties that can overwrite the `color` property.
116+
// Some developers seem to use this approach to easily overwrite the placeholder / label color.
117+
-webkit-text-fill-color: transparent;
118+
115119
// Remove the transition to prevent the placeholder
116120
// from overlapping when the label comes back down.
117121
transition: none;

0 commit comments

Comments
 (0)