Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30236 closed Cleanup/optimization (fixed)

UsernameField should use autocapitalize="none"

Reported by: Clayton Daley Owned by: pmisteliac
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

IOS devices often auto-capitalize the first letter in input fields. While this may be OK in a lot of places, it's not an acceptable behavior while usernames remain case sensitive (i.e. https://code.djangoproject.com/ticket/2273).

To address this issue, username inputs should include autocapitalize="none" among the attrs for the username (and possibly password) fields. I ran into this issue with django.contrib.auth.forms.AuthenticationForm, where autocapitalize="none" could be added to the attrs in the property-based field. However, I could see the argument for fixing it at the UsernameField so it cascades to other uses (e.g. UserCreationForm and UserChangeForm).

Change History (12)

comment:1 by Clayton Daley, 5 years ago

Summary: should Use autocapitalize="none"Username Fields should use autocapitalize="none"

comment:2 by Tim Graham, 5 years ago

Summary: Username Fields should use autocapitalize="none"UsernameField should use autocapitalize="none"
Triage Stage: UnreviewedAccepted

comment:3 by pmisteliac, 5 years ago

Owner: changed from nobody to pmisteliac
Status: newassigned

comment:4 by Nick Pope, 5 years ago

Out of curiosity, is the problem solved by using autocomplete="username"? There is already #29379 open for that.

Also see a past comment regarding setting these attributes on the widgets from the form.

comment:5 by Clayton Daley, 5 years ago

They all apply to inputs but are different e.g. see https://uxcellence.com/2014/tweaking-automatic-form-input

comment:6 by pmisteliac, 5 years ago

Has patch: set

comment:7 by Mariusz Felisiak, 5 years ago

Needs tests: set
Version: 2.1master

comment:8 by Mariusz Felisiak, 5 years ago

Needs tests: unset

comment:9 by Mariusz Felisiak, 5 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 9410db96:

Fixed #30236 -- Made UsernameField render with autocapitalize="none" HTML attribute.

This prevents automatic capitalization, which is the default behavior in
some browsers.

comment:11 by Nick Pope, 5 years ago

PR to add a release note.

(A release note was added for the autocomplete attribute that was committed more recently and I think it makes sense to highlight that this common source of irritation has been addressed.)

comment:12 by Mariusz Felisiak, 5 years ago

This is just a cleanup, I don't think that we need release notes. autocomplete is a new feature that's why it's mentioned in release notes.

Note: See TracTickets for help on using tickets.
Back to Top