Skip to content

Conversation

jelbourn
Copy link
Member

This creates a total duplicate of the floating-placeholder style mixin with insignificant values added to the rules. This exists because the mixin is used in two places; when Google's CSS Optimizer runs over this css (after compiling from sass), it combines those two declarations into one. However, one of those places uses :-webkit-autofill. When Firefox encounters this unknown pseuedo-class, it ignores the entire rule. To work around this, we force one of the delcarations to be technically different but still render the same by adding a tiny value to the transform / width.

…mization

This creates a total duplicate of the floating-placeholder style mixin with insignificant values added to the rules. This exists because the mixin is used in two places; when Google's CSS Optimizer runs over this css (after compiling from sass), it combines those two declarations into one. However, one of those places uses `:-webkit-autofill`. When Firefox encounters this unknown pseuedo-class, it ignores the entire rule. To work around this, we force one of the delcarations to be technically different but still render the same by adding a tiny value to the transform / width.
@jelbourn jelbourn requested a review from mmalerba as a code owner November 10, 2017 01:29
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 10, 2017
@jelbourn
Copy link
Member Author

Output looks like this now:

.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-placeholder {
  transform: translateY(-1.28125em) scale(.75) perspective(100px) translateZ(.001px);
  -ms-transform: translateY(-1.28125em) scale(.75);
  width: 133.33333%
}

.mat-form-field-can-float .mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-placeholder-wrapper .mat-form-field-placeholder {
  transform: translateY(-1.28125em) scale(.75) perspective(100px) translateZ(.002px);
  -ms-transform: translateY(-1.28125em) scale(.75);
  width: 133.33343%
}

@josephperrott josephperrott merged commit 691bb73 into angular:master Nov 10, 2017
@mmalerba
Copy link
Contributor

Can we file a bug against the CSS optimizer and put a TODO to remove this hack?

@jelbourn jelbourn deleted the form-field-floating-nodedupe branch April 2, 2018 22:31
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants