Skip to content

Commit f758cd9

Browse files
committed
Completed fix
1 parent f0c4e4f commit f758cd9

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

packages/material-ui/src/InputBase/InputBase.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const styles = theme => {
8686
// Make the flex item shrink with Firefox
8787
minWidth: 0,
8888
width: '100%', // Fix IE 11 width issue
89+
animationName: '$auto-fill-cancel',
8990
'&::-webkit-input-placeholder': placeholder,
9091
'&::-moz-placeholder': placeholder, // Firefox 19+
9192
'&:-ms-input-placeholder': placeholder, // IE 11
@@ -123,6 +124,9 @@ export const styles = theme => {
123124
'@keyframes auto-fill': {
124125
from: {},
125126
},
127+
'@keyframes auto-fill-cancel': {
128+
from: {},
129+
},
126130
/* Styles applied to the `input` element if `margin="dense"`. */
127131
inputMarginDense: {
128132
paddingTop: 4 - 1,
@@ -372,15 +376,11 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
372376
};
373377
}
374378

375-
const handleAutoFill = () => {
376-
// The change event is correcty triggered when the input is focused.
377-
// There is no need to detect autofill.
378-
if (fcs.focused) {
379-
return;
380-
}
381-
379+
const handleAutoFill = event => {
382380
// Provide a fake value as Chrome might not let you access it for security reasons.
383-
checkDirty({ value: 'x' });
381+
checkDirty(
382+
event.animationName.indexOf('auto-fill-cancel') !== -1 ? inputRef.current : { value: 'x' },
383+
);
384384
};
385385

386386
return (

0 commit comments

Comments
 (0)