I'm submitting a ... (check one with "x")
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request
Current behavior
Browsers autofills username/password fields if passwords were saved for the website.
Expected behavior
Inputs need a way to disable autocomplete. formly-js has a fix for Chrome: removeChromeAutoComplete
Minimal reproduction of the problem with instructions
Make an app with a login page and a settings page with Formly username/password inputs. Enter the login credentials and click yes when the browser prompts to save them. Navigate to the settings page and the inputs will display the saved login credentials.
What is the motivation / use case for changing the behavior?
Inputs are displaying the wrong values that could be saved by the user. I can't find a workaround, for example, setting autocomplete="user-password" on the password input after it's created, because at that point the browser already autofilled it.
Please tell us about your environment:
Windows 10 Pro
Angular version: 6.0.3
Browser: Chrome 67.0.3396.79, Firefox 60.0.2
Language: TypeScript 2.7.2
Node (for AoT issues): node --version = 8.9.1
Nevermind. I created a custom input with autocomplete="off" following this example: https://github.com/formly-js/ngx-formly/issues/473
or use attributes option:
templateOptions: {
attributes: {
autocomplete: 'off',
},
}
The attributes option didn't work for me.
I needed to add these dummy inputs before the custom inputs (source: https://stackoverflow.com/questions/15738259/disabling-chrome-autofill)
<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
@shp0 should it be for all fields if I have a complex form ?
Most helpful comment
or use
attributesoption: