templates: use field.id_for_label in field title id attribute (#74526)
gitea/gadjo/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2023-02-15 12:14:21 +01:00
parent bbcd17465f
commit 45bac77a26
1 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,7 @@
{% if field.field.required %}widget-required{% else %}widget-optional{% endif %}"
{% if field.id_for_label %}id="{{field.id_for_label}}_p"{% endif %}>
{% block widget-title %}
<div class="title" id="{{ field.name }}">
<div class="title" {% if field.id_for_label %}id="{{ field.id_for_label }}_title"{% endif %}>
{{ field.label_tag }}
{% if field.field.required %}
<span title="{% trans "This field is required." %}" class="required">*</span>
@ -16,7 +16,9 @@
</div>
{% endblock %}
{% block widget-content %}
<div class="content" aria-labelledby="{{ field.name }}" {% block widget-attrs %}{% endblock %}>
<div class="content"
{% if field.id_for_label %}aria-labelledby="{{ field.id_for_label }}_title"{% endif %}
{% block widget-attrs %}{% endblock %}>
{% block widget-error %}
{% if field.errors %}
<div class="error"><p>