[A11y] add missing autcomplete (#5236)

This commit is contained in:
Richard Schreiber
2025-06-11 10:47:17 +02:00
committed by GitHub
parent e8abe5cad8
commit 74cea09f6c
4 changed files with 13 additions and 7 deletions

View File

@@ -342,6 +342,7 @@ class ResetPasswordForm(forms.Form):
} }
email = forms.EmailField( email = forms.EmailField(
label=_('Email'), label=_('Email'),
widget=forms.EmailInput(attrs={'autocomplete': 'email'}),
) )
def __init__(self, request=None, *args, **kwargs): def __init__(self, request=None, *args, **kwargs):
@@ -389,12 +390,12 @@ class ChangePasswordForm(forms.Form):
) )
password_current = forms.CharField( password_current = forms.CharField(
label=_('Your current password'), label=_('Your current password'),
widget=forms.PasswordInput, widget=forms.PasswordInput(attrs={'autocomplete': 'current-password'}),
required=True required=True
) )
password = forms.CharField( password = forms.CharField(
label=_('New password'), label=_('New password'),
widget=forms.PasswordInput, widget=forms.PasswordInput(attrs={'minlength': '8', 'autocomplete': 'new-password'}),
max_length=4096, max_length=4096,
required=True required=True
) )
@@ -458,7 +459,7 @@ class ChangeInfoForm(forms.ModelForm):
} }
password_current = forms.CharField( password_current = forms.CharField(
label=_('Your current password'), label=_('Your current password'),
widget=forms.PasswordInput, widget=forms.PasswordInput(attrs={'autocomplete': 'current-password'}),
help_text=_('Only required if you change your email address'), help_text=_('Only required if you change your email address'),
max_length=4096, max_length=4096,
required=False required=False
@@ -472,6 +473,8 @@ class ChangeInfoForm(forms.ModelForm):
self.request = request self.request = request
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['email'].widget.attrs['autocomplete'] = 'email'
self.fields['name_parts'] = NamePartsFormField( self.fields['name_parts'] = NamePartsFormField(
max_length=255, max_length=255,
required=True, required=True,

View File

@@ -57,6 +57,8 @@ class WaitingListForm(forms.ModelForm):
event = self.event event = self.event
self.fields['email'].widget.attrs['autocomplete'] = 'email'
if event.settings.waiting_list_names_asked: if event.settings.waiting_list_names_asked:
self.fields['name_parts'] = NamePartsFormField( self.fields['name_parts'] = NamePartsFormField(
max_length=255, max_length=255,

View File

@@ -15,8 +15,9 @@
<div class="input-group{% if "voucher_invalid" in request.GET %} has-error{% endif %}"> <div class="input-group{% if "voucher_invalid" in request.GET %} has-error{% endif %}">
<span class="input-group-addon"><i class="fa fa-ticket fa-fw" aria-hidden="true"></i></span> <span class="input-group-addon"><i class="fa fa-ticket fa-fw" aria-hidden="true"></i></span>
<input type="text" class="form-control{% if "voucher_invalid" in request.GET %} has-error{% endif %}" name="voucher" id="voucher" <input type="text" class="form-control{% if "voucher_invalid" in request.GET %} has-error{% endif %}" name="voucher" id="voucher"
{% if "voucher_invalid" in request.GET %} aria-describedby="error-message"{% endif %} {% if "voucher_invalid" in request.GET %} aria-describedby="error-message"{% endif %}
placeholder="{% trans "Voucher code" %}" required="required"> autocomplete="off"
placeholder="{% trans "Voucher code" %}" required="required">
</div> </div>
</div> </div>
<input type="hidden" name="subevent" value="{{ subevent.id|default_if_none:"" }}" /> <input type="hidden" name="subevent" value="{{ subevent.id|default_if_none:"" }}" />

View File

@@ -34,13 +34,13 @@
{% endblocktrans %} {% endblocktrans %}
{% endif %} {% endif %}
</p> </p>
<p class="help-block"> <p class="help-block" id="add-to-list-description">
{% blocktrans trimmed %} {% blocktrans trimmed %}
You will <strong>not</strong> receive a confirmation email after you have been added to the waiting list. We will only contact you once a spot opens up. You will <strong>not</strong> receive a confirmation email after you have been added to the waiting list. We will only contact you once a spot opens up.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<p> <p>
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary" aria-describedby="add-to-list-description">
{% trans "Add me to the list" %} {% trans "Add me to the list" %}
</button> </button>
</p> </p>