Feat: Add autocomplete attribute to certain user-data specific fields#12080
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull request overview
Adds HTML autocomplete metadata to authentication-related form inputs to better support browser autofill and WCAG 2.1 SC 1.3.5 (Identify Input Purpose).
Changes:
- Add
autocompleteattributes to login email/password fields. - Add
autocomplete="email"to email inputs in account verification failure + “forgot IA email” flows. - Add
autocompleteattributes to Python-defined auth/register/reset forms inplugins/upstream.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| openlibrary/templates/login.html | Adds autocomplete for login identifier + password fields |
| openlibrary/templates/account/verify/failed.html | Adds autocomplete="email" to resend-verification email input |
| openlibrary/templates/account/email/forgot-ia.html | Adds autocomplete to email + password inputs for IA-email recovery |
| openlibrary/plugins/upstream/forms.py | Adds autocomplete attributes to login/register/forgot/reset form inputs |
Comments suppressed due to low confidence (1)
openlibrary/plugins/upstream/forms.py:157
ForgotPasswordcollects an email address but usesTextbox, which renders astype="text". Consider using theEmailinput type (or otherwise settingtype="email") so the rendered forgot-password form gets the correct semantics and benefits from browser validation/autofill.
return True
validate_password = Validator(_("Invalid password"), verify_password)
…dashii/openlibrary into 5003/feat/HTML-autocomplete-on-inputs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@lokesh You can have a look, while this PR has changes with low importance, one major issue I saw is that while some auth forms use forms defined in plugins/upstream/forms.py, some use native html and login.html uses a hybrid mix, this causes quite a lot of confusion in my opinion. Is this something worth creating an Issue ticket for and changing to python forms for consistency? |
Values are not being utilized as inputs are hardcoded in login.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Sadashii if you're interested, it would be helpful to have a broader look at our existing forms and the various paradigms used, and then propose a plan to update with the benefits laid out for us to evaluate. As for this PR, it's looking good. I'll try to get on testing and we can make sure everything works as expected. |
lokesh
left a comment
There was a problem hiding this comment.
LGTM
Tried login and signup flows on testing server w/o issue.
Closes #5003
This PR adds autocomplete attributes to certain user-related data fields on the site to enable faster input during auth steps
Technical
Testing
While most browsers these days autocomplete themselves based on attributes like type, name, in certain cases the autocomplete may help. Can be tested on the signup page, password field is defined as 'new-password' (as new account), browsers should now suggest a new password and not existing account password.
Screenshot
Stakeholders
@lokesh