This repository was archived by the owner on Jul 19, 2019. It is now read-only.
Allow setting HTML autocomplete attribute #217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
