a11y: add group role to blocks (#88620)
gitea/wcs/pipeline/head There was a failure building this commit
Details
gitea/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
4d5b309986
commit
7ed2d05f07
|
@ -461,6 +461,8 @@ class BlockSubWidget(CompositeWidget):
|
|||
class BlockWidget(WidgetList):
|
||||
template_name = 'qommon/forms/widgets/block.html'
|
||||
always_include_add_button = True
|
||||
a11y_role = 'group'
|
||||
a11y_labelledby = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -566,7 +568,8 @@ class BlockWidget(WidgetList):
|
|||
def render_title(self, title):
|
||||
attrs = {'id': 'form_label_%s' % self.get_name_for_id()}
|
||||
if not title or self.label_display == 'hidden':
|
||||
return htmltag('span', **attrs) + htmltext('</span>')
|
||||
attrs = {'class': 'sr-only'}
|
||||
return htmltag('span', **attrs) + htmltext('%s</span>') % (title or '')
|
||||
|
||||
if self.label_display == 'normal':
|
||||
return super().render_title(title)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% extends "qommon/forms/widget.html" %}
|
||||
|
||||
{% block widget-css-classes %}{{ block.super }} {% if widget.had_add_clicked %}wcs-block-add-clicked{% endif %} {% if widget.remove_button %}wcs-block-with-remove-button{% endif %}{% endblock %}
|
||||
|
||||
{% block widget-attrs %}id="form_{{ widget.field.id }}" {{ block.super }}{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue