Skip to content

Commit

Permalink
Completed fix
Browse files Browse the repository at this point in the history
  • Loading branch information
croraf committed Sep 24, 2019
1 parent f0c4e4f commit f758cd9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/material-ui/src/InputBase/InputBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const styles = theme => {
// Make the flex item shrink with Firefox
minWidth: 0,
width: '100%', // Fix IE 11 width issue
animationName: '$auto-fill-cancel',
'&::-webkit-input-placeholder': placeholder,
'&::-moz-placeholder': placeholder, // Firefox 19+
'&:-ms-input-placeholder': placeholder, // IE 11
Expand Down Expand Up @@ -123,6 +124,9 @@ export const styles = theme => {
'@keyframes auto-fill': {
from: {},
},
'@keyframes auto-fill-cancel': {
from: {},
},
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
paddingTop: 4 - 1,
Expand Down Expand Up @@ -372,15 +376,11 @@ const InputBase = React.forwardRef(function InputBase(props, ref) {
};
}

const handleAutoFill = () => {
// The change event is correcty triggered when the input is focused.
// There is no need to detect autofill.
if (fcs.focused) {
return;
}

const handleAutoFill = event => {
// Provide a fake value as Chrome might not let you access it for security reasons.
checkDirty({ value: 'x' });
checkDirty(
event.animationName.indexOf('auto-fill-cancel') !== -1 ? inputRef.current : { value: 'x' },
);
};

return (
Expand Down

0 comments on commit f758cd9

Please sign in to comment.