a11y: remove autofocus of username input field (#78108) #77
|
@ -36,7 +36,6 @@ from ..utils import misc as utils_misc
|
|||
|
||||
class AuthenticationForm(auth_forms.AuthenticationForm):
|
||||
username = auth_forms.UsernameField(
|
||||
widget=forms.TextInput(attrs={'autofocus': True}),
|
||||
required=True,
|
||||
)
|
||||
password = PasswordField(label=_('Password'))
|
||||
|
|
|
@ -748,9 +748,6 @@ def login_password_login(request, authenticator, *args, **kwargs):
|
|||
if request.user.is_authenticated and request.login_token.get('action'):
|
||||
form.initial['username'] = request.user.username or request.user.email
|
||||
form.fields['username'].widget.attrs['readonly'] = True
|
||||
form.fields['password'].widget.attrs['autofocus'] = True
|
||||
else:
|
||||
form.fields['username'].widget.attrs['autofocus'] = not (bool(context.get('block_index')))
|
||||
if app_settings.A2_ACCEPT_EMAIL_AUTHENTICATION:
|
||||
form.fields['username'].label = _('Username or email')
|
||||
if app_settings.A2_ACCEPT_PHONE_AUTHENTICATION:
|
||||
|
|
|
@ -101,7 +101,7 @@ def test_login_username_autofocus(settings, app, franceconnect):
|
|||
models.FcAuthenticator.objects.update(order=3)
|
||||
response = app.get('/login/')
|
||||
assert response.text.index('div id="fc-button"') > response.text.index('name="login-password-submit"')
|
||||
assert response.pyquery('#id_username').attr.autofocus is not None
|
||||
assert response.pyquery('#id_username').attr.autofocus is None
|
||||
|
||||
|
||||
def test_create(settings, app, franceconnect, hooks, service, mailoutbox):
|
||||
|
|
Loading…
Reference in New Issue