added attributes for a11y

This commit is contained in:
Beverly Nguyen
2024-11-01 11:47:25 -07:00
parent 60e9ac18f5
commit 4d0d92f825

View File

@@ -38,22 +38,28 @@
{% for item in template_list %} {% for item in template_list %}
{% set item_link_content %} {% set item_link_content %}
{% if item.is_folder %} {% if item.is_folder %}
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=item.id) }}" <a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=item.id) }}"
class="usa-link template-list-folder"> class="usa-link template-list-folder"
<span class="live-search-relevant">{{- format_item_name(item.name) -}}</span> tabindex="0"
</a> role="link"
{% elif not item.ancestors %} aria-label="{{ format_item_name(item.name) }}">
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.id) }}" <span class="live-search-relevant">{{- format_item_name(item.name) -}}</span>
class="usa-link template-list-template"> </a>
<span class="live-search-relevant"> {% elif not item.ancestors %}
{%- if current_service.api_keys -%} <a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.id) }}"
<span class="display-none">{{ item.id }} </span> class="usa-link template-list-template"
{%- endif -%} tabindex="0"
{{- format_item_name(item.name) -}} role="link"
</span> aria-label="{{ format_item_name(item.name) }}">
</a> <span class="live-search-relevant">
{% endif %} {%- if current_service.api_keys -%}
<span class="display-none">{{ item.id }} </span>
{%- endif -%}
{{- format_item_name(item.name) -}}
</span>
</a>
{% endif %}
{% endset %} {% endset %}
{% set label_content %} {% set label_content %}
@@ -82,6 +88,8 @@
"id": "templates-or-folder-" ~ item.id, "id": "templates-or-folder-" ~ item.id,
"classes": "template-list-item template-list-item-with-checkbox {}".format( "classes": "template-list-item template-list-item-with-checkbox {}".format(
"template-list-item-hidden-by-default" if item.ancestors else "template-list-item-without-ancestors"), "template-list-item-hidden-by-default" if item.ancestors else "template-list-item-without-ancestors"),
"attributes": { "role": "checkbox", "aria-describedby": item.id ~ "-item-hint" },
"after": item_link_content ~ item_meta "after": item_link_content ~ item_meta
} %} } %}
{% set _ = checkboxes_data.append(checkbox_config) %} {% set _ = checkboxes_data.append(checkbox_config) %}