-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete for password inputType issue #38
Comments
Actually, you can work around this by adding a
to |
@gclements-chwy what about autocomplete="one-time-code"? Theoretically, that should help the user agent identify when it should suggest auto-filling with the code last received via SMS. It also won't try to populate with any stored passwords. |
@msadecki1-chwy I think |
@gclements-chwy well the autocomplete attribute was designed specifically to aid user agents in storing and retrieving common form values (https://www.w3.org/TR/html52/sec-forms.html#autofill), but unfortunately, Chrome is notorious for thinking its smarter than the developer, even the one who knows what their doing, and applies its own heuristics to make autocomplete "better." The reason why new-password works is because if the user is specifying a new password, e.g. after having put in their current password, there is no autocomplete value because they've never filled it out before; it's "new". If Chrome wasn't trying to be so smart, it would honor autocomplete="off" which, as the HTML spec defines:
This also has accessibility implications because the accessibility API, and accessibility plugins, can use this value to inform the user what type of info is expected in the form field, which can be especially helpful for users with cognitive disabilities, or even any user filling out a page in a language not familiar to them. Screen readers may also provide this information to the user in case the author didn't provide a label, or a meaningful label, for the input: This is why we really can't really chose a value just because it has the desired behavior in a particular browser by circumstance only. If this is truly a one-time-code, like one for two-factor auth, then I would one-time-code would be appropriate, but we really shouldn't use new-password if its not a new-password field. If the use case here is truly a PIN number (unique from the users password) we're at an impasse, because there is no autocomplete value "pin" (although there should be, something which would have to be brought up to WHATWG or W3C. If the type attribute password is being used, Chrome will ignore any autocomplete value and pre-populate with any stored password for the domain... |
@msadecki1-chwy I agree with all that. Unfortunately what the spec says and what browsers implement (and don't want to change since it is now expected behavior) are two different things. The link I posted above seems to say that you should use |
Hi folks, mounted () {
let modalInputs = document.querySelectorAll("#OtpForm input");
for (let i = 0; i < modalInputs.length; i++) {
modalInputs[i].value = '';
modalInputs[i].autocomplete = 'new-password';
}
} Hope this help anyone. |
Hi,
I think the input tag in SingleOtpInput needs autocomplete="off" (or maybe autocomplete="new-password") when inputType is password. It looks like Chrome is filling in the first field in a 4 input otp-input no matter what I do. (Even wrapping in a
<form autocomplete="off">
.)The text was updated successfully, but these errors were encountered: