react-autocomplete icon indicating copy to clipboard operation
react-autocomplete copied to clipboard

Allow setting HTML autocomplete attribute

Open jordanlapointe opened this issue 8 years ago • 2 comments

Currently, react-autocomplete inputs are set to have an HTML autocomplete attribute value of "off". This is smart for preventing a stacking of autocomplete UIs, but can cause problems in some scenarios.

For example, a checkout form may have an address field with as-you-type suggestions shown using react-autocomplete. A user would expect to be able to click on the name field, click a browser-provided suggestion, and have all saved fields fields completed (including name, address, state and zip). Because of the hardcoded "off" value, all fields in this scenario will autofill except for the address field, leading to confusion for the user.

I propose allowing developers to set the autocomplete attribute with the current value as a fallback. This would enable setting the attribute based on focus—only setting the attribute to "off" when the react-autocomplete input is in use.

Example: screen shot 2017-03-28 at 3 21 22 pm

jordanlapointe avatar Mar 28 '17 20:03 jordanlapointe

My solution to this was to define the renderInput prop:

renderInput: props => <input {...props} autoComplete='new-password' />;

naoisegolden avatar Jul 13 '18 10:07 naoisegolden

Is there a chance for this PR to be merged?

bigsauron avatar Feb 01 '19 19:02 bigsauron