Turn autofocus on for copy template

Accessibility audit uncovered issues screen-reader users would
have with autofocus on Notify pages. Autofocus can lead to
confusion for those types of users and make them miss parts
of the page.

Hence, we decided that autofocus will be turned off by default
for live-search component.

We decided to keep the autofocus on for live-search text box when:
1. the page is a task page - as opposed to browsing pages, where
user wonders freely, task pages have more established flow, so
page focusing on textbox can actually be helpful.
2. page does not have actionable elements above the autofocus.
This commit is contained in:
Pea Tyczynska
2020-09-10 16:31:35 +01:00
committed by Tom Byers
parent 2d512cb0fd
commit a73573c165

View File

@@ -2,15 +2,16 @@
{% from "components/live-search.html" import live_search %}
{% extends "withnav_template.html" %}
{% set page_title = "Copy an existing template" %}
{% block service_page_title %}
Copy an existing template
{{ page_title }}
{% endblock %}
{% block maincolumn_content %}
<div class="bottom-gutter-1-2">
<h1 class="heading-large">Copy an existing template</h1>
<h1 class="heading-large">{{ page_title }}</h1>
{{ copy_folder_path(template_folder_path, current_service.id, from_service, current_user) }}
</div>
{% if not services_templates_and_folders.templates_to_show %}
@@ -18,7 +19,12 @@
This folder is empty
</p>
{% else %}
{{ live_search(target_selector='#template-list .template-list-item', show=True, form=search_form) }}
{{ live_search(
target_selector='#template-list .template-list-item',
show=True,
form=search_form,
autofocus=True
) }}
<nav id="template-list">
{% for item in services_templates_and_folders %}
<div class="template-list-item {% if item.ancestors %}template-list-item-hidden-by-default{% endif %} {% if not item.ancestors %}template-list-item-without-ancestors{% endif %}">