Skip to content

Commit 8e43b48

Browse files
mmalerbaandrewseguin
authored andcommitted
fix(cdk/text-field): fix autofill listener on Chrome 80 (#18468)
* fix(cdk/text-field): fix autofill listener on Chrome 80 * address feedback and fix lint (cherry picked from commit 4b329f0)
1 parent 8082a61 commit 8e43b48

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.stylelintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
"unit-case": "lower",
4646
"unit-no-unknown": true,
47-
"unit-whitelist": ["px", "%", "deg", "ms", "em", "vh", "vw", "vmin"],
47+
"unit-whitelist": ["px", "%", "deg", "s", "ms", "em", "vh", "vw", "vmin"],
4848

4949
"value-list-comma-space-after": "always-single-line",
5050
"value-list-comma-space-before": "never",

src/cdk/text-field/_text-field.scss

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
@keyframes cdk-text-field-autofill-end {/*!*/}
99

1010
.cdk-text-field-autofill-monitored:-webkit-autofill {
11-
animation-name: cdk-text-field-autofill-start;
11+
// Since Chrome 80 we need a 1ms delay, or the animationstart event won't fire.
12+
animation: cdk-text-field-autofill-start 0s 1ms;
1213
}
1314

1415
.cdk-text-field-autofill-monitored:not(:-webkit-autofill) {
15-
animation-name: cdk-text-field-autofill-end;
16+
// Since Chrome 80 we need a 1ms delay, or the animationstart event won't fire.
17+
animation: cdk-text-field-autofill-end 0s 1ms;
1618
}
1719

1820
// Remove the resize handle on autosizing textareas, because whatever height
@@ -49,13 +51,14 @@ $cdk-text-field-autofill-color-frame-count: 0;
4951
}
5052

5153
&:-webkit-autofill {
52-
animation-name: cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count};
53-
animation-fill-mode: both;
54+
animation: cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count} both;
5455
}
5556

5657
&.cdk-text-field-autofill-monitored:-webkit-autofill {
57-
animation-name: cdk-text-field-autofill-start,
58-
cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count};
58+
// Since Chrome 80 we need a 1ms delay for cdk-text-field-autofill-start, or the animationstart
59+
// event won't fire.
60+
animation: cdk-text-field-autofill-start 0s 1ms,
61+
cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count} both;
5962
}
6063

6164
$cdk-text-field-autofill-color-frame-count:

0 commit comments

Comments
 (0)