Skip to content

Commit 884d2fa

Browse files
Added inputAutocompleteValue prop to allow consuming applications to alter autofill disabling solution as Chrome evolves to ignore web standards in increasingly bold and creative ways. Also updates the default 'off' value to 'new-password' as that's what currently works
1 parent bdbdd39 commit 884d2fa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export default class ReactGoogleAutocomplete extends React.Component {
77
types: PropTypes.array,
88
componentRestrictions: PropTypes.object,
99
bounds: PropTypes.object,
10-
fields: PropTypes.array
10+
fields: PropTypes.array,
11+
inputAutocompleteValue: PropTypes.string,
1112
};
1213

1314
constructor(props) {
@@ -57,7 +58,7 @@ export default class ReactGoogleAutocomplete extends React.Component {
5758
const observerHack = new MutationObserver(() => {
5859
observerHack.disconnect();
5960
if (this.refs && this.refs.input) {
60-
this.refs.input.autocomplete = 'off';
61+
this.refs.input.autocomplete = this.props.inputAutocompleteValue || 'new-password';
6162
}
6263
});
6364
observerHack.observe(this.refs.input, {
@@ -111,7 +112,6 @@ export class ReactCustomGoogleAutocomplete extends React.Component {
111112
(predictions, status) => {
112113
if (status === 'OK' && predictions && predictions.length > 0) {
113114
this.props.onOpen(predictions);
114-
console.log(predictions);
115115
} else {
116116
this.props.onClose();
117117
}

0 commit comments

Comments
 (0)