Compare commits

...

5 Commits

Author SHA1 Message Date
Mira Weller
96bb380390 First attempt 2025-06-05 13:39:54 +02:00
Mira Weller
080bfbd4fb Update help text 2025-06-05 13:39:39 +02:00
Richard Schreiber
6aa3747403 Fix sneak-peek missing inert-attribute (#5207) 2025-06-03 21:49:59 +02:00
Raphael Michel
d255c40a0b [A11y] Do not set autocomplete section if autocomplete is off (#5194) 2025-06-03 11:08:17 +02:00
Richard Schreiber
f600200ec6 [A11y] improve questions step (#5199)
* [A11y] fix copy-answer buttons being inside interactive summary

* fix legends missing fieldsets

* indent explanation-texts

* Do not indent explanation, move copy-button after explanation

* fix code indent

* remove unneccessary change
2025-06-03 10:06:40 +02:00
6 changed files with 59 additions and 32 deletions

View File

@@ -182,7 +182,13 @@ class NamePartsWidget(forms.MultiWidget):
if self.field.required: if self.field.required:
these_attrs['required'] = 'required' these_attrs['required'] = 'required'
these_attrs.pop('data-no-required-attr', None) these_attrs.pop('data-no-required-attr', None)
these_attrs['autocomplete'] = (self.attrs.get('autocomplete', '') + ' ' + self.autofill_map.get(self.scheme['fields'][i][0], 'off')).strip()
autofill_section = self.attrs.get('autocomplete', '')
autofill_by_name_scheme = self.autofill_map.get(self.scheme['fields'][i][0], 'off')
if autofill_by_name_scheme == "off" or autofill_section.strip() == "off":
these_attrs['autocomplete'] = "off"
else:
these_attrs['autocomplete'] = (autofill_section + ' ' + autofill_by_name_scheme).strip()
these_attrs['data-size'] = self.scheme['fields'][i][2] these_attrs['data-size'] = self.scheme['fields'][i][2]
these_attrs['aria-label'] = self.scheme['fields'][i][1] these_attrs['aria-label'] = self.scheme['fields'][i][1]
else: else:
@@ -987,7 +993,11 @@ class BaseQuestionsForm(forms.Form):
for k, v in self.fields.items(): for k, v in self.fields.items():
if v.widget.attrs.get('autocomplete') or k == 'attendee_name_parts': if v.widget.attrs.get('autocomplete') or k == 'attendee_name_parts':
v.widget.attrs['autocomplete'] = 'section-{} '.format(self.prefix) + v.widget.attrs.get('autocomplete', '') autocomplete = v.widget.attrs.get('autocomplete', '')
if autocomplete.strip() == "off":
v.widget.attrs['autocomplete'] = 'off'
else:
v.widget.attrs['autocomplete'] = 'section-{} '.format(self.prefix) + autocomplete
def clean(self): def clean(self):
from pretix.base.addressvalidation import \ from pretix.base.addressvalidation import \
@@ -1201,7 +1211,11 @@ class BaseInvoiceAddressForm(forms.ModelForm):
for k, v in self.fields.items(): for k, v in self.fields.items():
if v.widget.attrs.get('autocomplete') or k == 'name_parts': if v.widget.attrs.get('autocomplete') or k == 'name_parts':
v.widget.attrs['autocomplete'] = 'section-invoice billing ' + v.widget.attrs.get('autocomplete', '') autocomplete = v.widget.attrs.get('autocomplete', '')
if autocomplete.strip() == "off":
v.widget.attrs['autocomplete'] = 'off'
else:
v.widget.attrs['autocomplete'] = 'section-invoice billing ' + autocomplete
def clean(self): def clean(self):
from pretix.base.addressvalidation import \ from pretix.base.addressvalidation import \

View File

@@ -2951,7 +2951,7 @@ Your {organizer} team""")) # noqa: W291
'serializer_class': serializers.BooleanField, 'serializer_class': serializers.BooleanField,
'form_kwargs': dict( 'form_kwargs': dict(
label=_('Show event title even if a header image is present'), label=_('Show event title even if a header image is present'),
help_text=_('The title will only be shown on the event front page. If no header image is uploaded for the event, but the header image ' help_text=_('If no header image is uploaded for the event, but the header image '
'from the organizer profile is used, this option will be ignored and the event title will always be shown.'), 'from the organizer profile is used, this option will be ignored and the event title will always be shown.'),
) )
}, },

View File

@@ -123,6 +123,15 @@
{% endif %} {% endif %}
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{% if event_logo and event_logo_show_title %}
<h2 class="content-header">
{{ event.name }}
{% if request.event.settings.show_dates_on_frontpage %}
<small>{{ event.get_date_range_display_as_html }}</small>
{% endif %}
</h2>
<hr>
{% endif %}
{% if request.event.testmode %} {% if request.event.testmode %}
{% if request.sales_channel.type_instance.testmode_supported %} {% if request.sales_channel.type_instance.testmode_supported %}
<div class="alert alert-warning"> <div class="alert alert-warning">
@@ -168,9 +177,8 @@
</strong></p> </strong></p>
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if messages %} {% if messages %}
{% for message in messages %} {% for message in messages %}
<div class="alert {{ message.tags }}"{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %} id="error-message"{% endif %}> <div class="alert {{ message.tags }}"{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %} id="error-message"{% endif %}>

View File

@@ -1,5 +1,6 @@
{% extends "pretixpresale/event/checkout_base.html" %} {% extends "pretixpresale/event/checkout_base.html" %}
{% load i18n %} {% load i18n %}
{% load icon %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load rich_text %} {% load rich_text %}
{% load lists %} {% load lists %}
@@ -74,14 +75,6 @@
{% if pos.variation %} {% if pos.variation %}
{{ pos.variation }} {{ pos.variation }}
{% endif %}</strong> {% endif %}</strong>
{% if forloop.counter > 1 %}
<span class="text-right flip">
{% if event.settings.checkout_show_copy_answers_button %}
<button type="button" data-id="{{ forloop.counter0 }}" name="copy"
class="js-copy-answers btn btn-default btn-xs">{% trans "Copy answers from above" %}</button>
{% endif %}
</span>
{% endif %}
</h3> </h3>
</summary> </summary>
<div> <div>
@@ -89,6 +82,17 @@
{% if event.settings.attendee_data_explanation_text and pos.item.ask_attendee_data %} {% if event.settings.attendee_data_explanation_text and pos.item.ask_attendee_data %}
{{ event.settings.attendee_data_explanation_text|rich_text }} {{ event.settings.attendee_data_explanation_text|rich_text }}
{% endif %} {% endif %}
{% if forloop.counter > 1 and event.settings.checkout_show_copy_answers_button %}
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<button type="button" data-id="{{ forloop.counter0 }}" name="copy"
class="js-copy-answers btn btn-default btn-sm">
{% icon "files-o" %}
{% trans "Copy answers from above" %}
</button>
</div>
</div>
{% endif %}
{% if pos.seat %} {% if pos.seat %}
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label"> <label class="col-md-3 control-label">
@@ -127,15 +131,14 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
<fieldset>
<legend class="sr-only">{{ pos.item.name }}{% if pos.variation %} {{ pos.variation }}{% endif %}</legend>
{% for form in forms %} {% for form in forms %}
{% if form.pos.item != pos.item %} {% if form.pos.item != pos.item %}
</fieldset>
<fieldset>
{# Add-Ons #} {# Add-Ons #}
<legend{% if profiles_data %} class="profile-add-on-legend"{% endif %}> <legend{% if profiles_data %} class="profile-add-on-legend"{% endif %}>
{% if form.show_copy_answers_to_addon_button and event.settings.checkout_show_copy_answers_button %}
<span class="pull-right flip">
<button type="button" data-id="{{ forloop.parentloop.counter0 }}" data-addonid="{{ forloop.counter0 }}" name="copy" class="js-copy-answers-addon btn btn-default btn-xs">{% trans "Copy answers" %}</button>
</span>
{% endif %}
+ {{ form.pos.item.name }}{% if form.pos.variation %} {{ form.pos.variation.value }}{% endif %} + {{ form.pos.item.name }}{% if form.pos.variation %} {{ form.pos.variation.value }}{% endif %}
</legend> </legend>
{% endif %} {% endif %}
@@ -157,8 +160,20 @@
</div> </div>
{% endif %} {% endif %}
{% if form.show_copy_answers_to_addon_button and event.settings.checkout_show_copy_answers_button %}
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<button type="button" data-id="{{ forloop.parentloop.counter0 }}" data-addonid="{{ forloop.counter0 }}" name="copy" class="js-copy-answers-addon btn btn-default btn-sm">
{% icon "files-o" %}
{% trans "Copy answers from above" %}
</button>
</div>
</div>
{% endif %}
{% bootstrap_form form layout="checkout" %} {% bootstrap_form form layout="checkout" %}
</div> </div>
</fieldset>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View File

@@ -54,11 +54,6 @@
{% if request.event.has_subevents %} {% if request.event.has_subevents %}
{% if not subevent %} {% if not subevent %}
{% if event_logo and event_logo_show_title %}
<h2 class="content-header">
{{ event.name }}
</h2>
{% endif %}
{% if frontpage_text %} {% if frontpage_text %}
<div> <div>
{{ frontpage_text|rich_text }} {{ frontpage_text|rich_text }}
@@ -131,14 +126,6 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% else %} {% else %}
{% if event_logo and event_logo_show_title %}
<h2 class="content-header">
{{ event.name }}
{% if request.event.settings.show_dates_on_frontpage %}
<small>{{ event.get_date_range_display_as_html }}</small>
{% endif %}
</h2>
{% endif %}
{% if frontpage_text %} {% if frontpage_text %}
<div> <div>
{{ frontpage_text|rich_text }} {{ frontpage_text|rich_text }}

View File

@@ -12,10 +12,12 @@ setup_collapsible_details = function (el) {
return; return;
} }
content.setAttribute('aria-hidden', 'true'); content.setAttribute('aria-hidden', 'true');
content.setAttribute('inert', true);
button.setAttribute('aria-expanded', 'false'); button.setAttribute('aria-expanded', 'false');
button.addEventListener('click', function (e) { button.addEventListener('click', function (e) {
button.setAttribute('aria-expanded', 'true'); button.setAttribute('aria-expanded', 'true');
content.setAttribute('aria-hidden', 'false'); content.setAttribute('aria-hidden', 'false');
content.removeAttribute('inert');
content.addEventListener('transitionend', function() { content.addEventListener('transitionend', function() {
content.classList.remove('sneak-peek-content'); content.classList.remove('sneak-peek-content');
@@ -47,6 +49,7 @@ setup_collapsible_details = function (el) {
container.removeEventListener("toggle", removeSneekPeakWhenClosed); container.removeEventListener("toggle", removeSneekPeakWhenClosed);
trigger.remove(); trigger.remove();
content.removeAttribute('aria-hidden'); content.removeAttribute('aria-hidden');
content.removeAttribute('inert');
content.classList.remove('sneak-peek-content'); content.classList.remove('sneak-peek-content');
} }
} }