diff --git a/plinth/modules/networks/forms.py b/plinth/modules/networks/forms.py index 20b9260c0..784a5b5e7 100644 --- a/plinth/modules/networks/forms.py +++ b/plinth/modules/networks/forms.py @@ -17,11 +17,6 @@ class ConnectionTypeSelectForm(forms.Form): choices=[(key, value) for key, value in network.CONNECTION_TYPE_NAMES.items()]) - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.fields['connection_type'].widget.attrs.update( - {'autofocus': 'autofocus'}) - class ConnectionForm(forms.Form): """Base form to create/edit a connection.""" diff --git a/plinth/modules/users/forms.py b/plinth/modules/users/forms.py index 3f03ecbf4..e221e9f1a 100644 --- a/plinth/modules/users/forms.py +++ b/plinth/modules/users/forms.py @@ -209,7 +209,6 @@ class UserUpdateForm(ValidNewUsernameCheckMixin, PasswordConfirmForm, super().__init__(*args, **kwargs) self.is_last_admin_user = get_last_admin_user() == self.username self.fields['username'].widget.attrs.update({ - 'autofocus': 'autofocus', 'autocapitalize': 'none', 'autocomplete': 'username' }) @@ -356,7 +355,10 @@ class FirstBootForm(ValidNewUsernameCheckMixin, auth.forms.UserCreationForm): def __init__(self, *args, **kwargs): self.request = kwargs.pop('request') super().__init__(*args, **kwargs) - self.fields['username'].widget.attrs.update({'autofocus': 'autofocus'}) + # The wizard step has text to be read before entering the username. + # Don't confuse screen readers by jumping directly to the username + # field. + self.fields['username'].widget.attrs.pop('autofocus', None) def save(self, commit=True): """Create and log the user in."""