Skip to content

fix(form-field): placeholder not hiding if -webkit-text-fill-color is used #12076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/lib/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
// input color in IE, if the consumer overrides it with a higher specificity.
color: transparent !important;

// Overwrite browser specific CSS properties that can overwrite the `color` property.
// Some developers seem to use this approach to easily overwrite the placeholder and
// label color. See: https://github.com/angular/material2/issues/12074
-webkit-text-fill-color: transparent;

// Remove the transition to prevent the placeholder
// from overlapping when the label comes back down.
transition: none;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ $mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-a
.mat-form-field-hide-placeholder & {
color: transparent;

// Overwrite browser specific CSS properties that can overwrite the `color` property.
// Some developers seem to use this approach to easily overwrite the placeholder / label color.
-webkit-text-fill-color: transparent;

// Remove the transition to prevent the placeholder
// from overlapping when the label comes back down.
transition: none;
Expand Down