diff options
| author | Moshe Nahmias <moshegrey@gmail.com> | 2022-09-26 22:06:48 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-26 21:06:48 +0200 |
| commit | d938b3b2577807ffd585f654caa0f37d9574e565 (patch) | |
| tree | 362f5b73f5e246a969adf30182476eb88436113b | |
| parent | 2cd7ab1ef6e309b4dd348248385f9753e757d7d0 (diff) | |
Fixed #34040 -- Removed autofocus from admin search box.
| -rw-r--r-- | django/contrib/admin/templates/admin/search_form.html | 2 | ||||
| -rw-r--r-- | docs/releases/4.2.txt | 3 | ||||
| -rw-r--r-- | tests/admin_changelist/tests.py | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/django/contrib/admin/templates/admin/search_form.html b/django/contrib/admin/templates/admin/search_form.html index 7f65211582..ad86af91cf 100644 --- a/django/contrib/admin/templates/admin/search_form.html +++ b/django/contrib/admin/templates/admin/search_form.html @@ -3,7 +3,7 @@ <div id="toolbar"><form id="changelist-search" method="get"> <div><!-- DIV needed for valid HTML --> <label for="searchbar"><img src="{% static "admin/img/search.svg" %}" alt="Search"></label> -<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" autofocus{% if cl.search_help_text %} aria-describedby="searchbar_helptext"{% endif %}> +<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar"{% if cl.search_help_text %} aria-describedby="searchbar_helptext"{% endif %}> <input type="submit" value="{% translate 'Search' %}"> {% if show_result_count %} <span class="small quiet">{% blocktranslate count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktranslate %} (<a href="?{% if cl.is_popup %}{{ is_popup_var }}=1{% endif %}">{% if cl.show_full_result_count %}{% blocktranslate with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktranslate %}{% else %}{% translate "Show all" %}{% endif %}</a>)</span> diff --git a/docs/releases/4.2.txt b/docs/releases/4.2.txt index 80c0d97bfc..2520d14361 100644 --- a/docs/releases/4.2.txt +++ b/docs/releases/4.2.txt @@ -319,6 +319,9 @@ Miscellaneous * :ttag:`{% blocktranslate asvar … %}<blocktranslate>` result is now marked as safe for (HTML) output purposes. +* The ``autofocus`` HTML attribute in the admin search box is removed as it can + be confusing for screen readers. + .. _deprecated-features-4.2: Features deprecated in 4.2 diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index 24c24a670b..b85d5383cd 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -1537,7 +1537,7 @@ class ChangeListTests(TestCase): self.assertContains( response, '<input type="text" size="40" name="q" value="" id="searchbar" ' - 'autofocus aria-describedby="searchbar_helptext">', + 'aria-describedby="searchbar_helptext">', ) |
