The problem is with the browser's autofill, not the field.
Many years ago we could use autocomplete=off but this feature has been removed from browsers.
I tried renaming the field to something silly, think something like flablarbderp
. Nope. It still gets picked up because the field type is password
.
I tried the checkbox idea; it's an obvious one. This was even worse! The field was disabled, but it was still auto-filled by the browser. This means the next time you enabled the checkbox, you would get the wrong password from a previous auto-fill you didn't even know took place.
The best thing I could do is add a small delay to allow the browser –or whatever password manager you use– to auto-fill the field, then replace its contents with the stored value. This works for MOST browsers and MOST password managers, but some are beyond annoying and will change the field back after its value is changed programmatically. You have one of those.
The only thing left is that you configure your browser / password manager not to auto-fill this form. I'm using 1Password, it does not try to auto-fill this field. Neither did KeePassXC which I was using previously.
Remember, the only other option on our end would be replacing password fields with regular text boxes and changing the field names to something like YW5naWVfcGFzc3dvcmQ=
, and changing the field's label so that the word “password” is not present (probably encoding the o's as Greek omicrons). This would create three new, major problems, namely: a. people would be upset passwords are visible (a fairly reasonable complaint, solving which would bring us back to square one); b. it makes development and troubleshooting absolute hell for everyone, leading to simple bugs that are nigh impossible to resolve as we'd have to go through 108 stupidly named fields making it extremely unlikely we wouldn't miss something "obvious"; and c. visually impaired and blind people would be unable to use the software because passwοrd is announced as "pass-y'-omicron-rud'". None of these problems are worth having to address a fringe issue which at the end of the day has nothing to do with our software and everything to do with some third party software that's not under our control and which can ultimately be configured not to break your perfectly functioning forms.
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!