The purpose of each input field collecting information about the user can be programmatically determined when:
- The input field serves a purpose identified in the Input Purposes for user interface components section; and
- The content is implemented using technologies with support for identifying the expected meaning for form input data.
Identify the purpose of form fields programmatically.
Helps browsers and assistive technologies provide appropriate suggestions or modifications.
Use appropriate visible labels.
When you have a field that collects data on the user, ensure you define the input purpose correctly. That way, the autocomplete will work as expected. Check the list of input purposes on W3.org.