Fixed #34040 -- Removed autofocus from admin search box.

This commit is contained in:
Moshe Nahmias 2022-09-26 22:06:48 +03:00 committed by GitHub
parent 2cd7ab1ef6
commit d938b3b257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -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>

View File

@ -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

View File

@ -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">',
)