Add accessibility attributes to sortable table headers. (#3647)
This commit is contained in:
@@ -74,6 +74,11 @@
|
||||
{% if title != 'actions' and not headerOptions.orderBy is same as(false) %}
|
||||
{% if orderBy == headerOptions.orderBy %}
|
||||
{% set headerClass = headerClass ~ ' sortable sorting_' ~ (order) %}
|
||||
{% if order == 'asc' %}
|
||||
{% set ariaSort = 'ascending' %}
|
||||
{% else %}
|
||||
{% set ariaSort = 'descending' %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set headerClass = headerClass ~ ' sortable sorting' %}
|
||||
{% endif %}
|
||||
@@ -84,7 +89,7 @@
|
||||
{% elseif title is not empty and title != 'actions' %}
|
||||
{% set headerTitle = (translationPrefix ~ title)|trans({}, translationDomain) %}
|
||||
{% endif %}
|
||||
<th data-field="{{ title }}" {% if not headerOptions.orderBy is same as(false) %}data-order="{{ headerOptions.orderBy }}" {% endif %}class="{{ headerClass }}">
|
||||
<th data-field="{{ title }}" {% if not headerOptions.orderBy is same as(false) %}data-order="{{ headerOptions.orderBy }}" role="button" {% endif %}{% if ariaSort is defined %}aria-sort="{{ ariaSort }}" {% endif %}class="{{ headerClass }}">
|
||||
{% if headerOptions.html_before is defined %}
|
||||
{{ headerOptions.html_before|raw }}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user