1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Fixed #34832 -- Made admin's header content render in <header> tag.

Header tag was changed to <header> get the landmark banner for
accessibility.
This commit is contained in:
Sarah Abderemane 2023-09-13 21:25:02 +02:00 committed by Mariusz Felisiak
parent 68d769e691
commit 814e7bc220
5 changed files with 13 additions and 9 deletions

View File

@ -887,6 +887,7 @@ answer newbie questions, and generally made Django that much better:
Sander Dijkhuis <sander.dijkhuis@gmail.com>
Sanket Saurav <sanketsaurav@gmail.com>
Sanyam Khurana <sanyam.khurana01@gmail.com>
Sarah Abderemane <https://github.com/sabderemane>
Sarah Boyce <https://github.com/sarahboyce>
Sarthak Mehrish <sarthakmeh03@gmail.com>
schwank@gmail.com

View File

@ -834,10 +834,6 @@ a.deletelink:focus, a.deletelink:hover {
height: 100%;
}
#container > div {
flex-shrink: 0;
}
#container > .main {
display: flex;
flex: 1 0 auto;
@ -922,7 +918,6 @@ a.deletelink:focus, a.deletelink:hover {
padding: 10px 40px;
background: var(--header-bg);
color: var(--header-color);
overflow: hidden;
}
#header a:link, #header a:visited, #logout-form button {

View File

@ -32,7 +32,7 @@
{% if not is_popup %}
<!-- Header -->
{% block header %}
<div id="header">
<header id="header">
<div id="branding">
{% block branding %}{% endblock %}
</div>
@ -66,7 +66,7 @@
{% endif %}
{% endblock %}
{% block nav-global %}{% endblock %}
</div>
</header>
{% endblock %}
<!-- END Header -->
{% block nav-breadcrumbs %}

View File

@ -629,8 +629,9 @@ Miscellaneous
a page. Having two ``<h1>`` elements was confusing and the site header wasn't
helpful as it is repeated on all pages.
* In order to improve accessibility, the admin's main content area is now
rendered in a ``<main>`` tag instead of ``<div>``.
* In order to improve accessibility, the admin's main content area and header
content area are now rendered in a ``<main>`` and ``<header>`` tag instead of
``<div>``.
* On databases without native support for the SQL ``XOR`` operator, ``^`` as
the exclusive or (``XOR``) operator now returns rows that are matched by an

View File

@ -1516,6 +1516,13 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
'<meta name="viewport" content="width=device-width, initial-scale=1.0">',
)
def test_header(self):
response = self.client.get(reverse("admin:index"))
self.assertContains(response, '<header id="header">')
self.client.logout()
response = self.client.get(reverse("admin:login"))
self.assertContains(response, '<header id="header">')
@override_settings(
AUTH_PASSWORD_VALIDATORS=[