Skip to content

Commit

Permalink
Fixed #34832 -- Made admin's header content render in <header> tag.
Browse files Browse the repository at this point in the history
Header tag was changed to <header> get the landmark banner for
accessibility.
  • Loading branch information
sabderemane authored and felixxm committed Sep 15, 2023
1 parent 68d769e commit 814e7bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@ answer newbie questions, and generally made Django that much better:
Sander Dijkhuis <[email protected]>
Sanket Saurav <[email protected]>
Sanyam Khurana <[email protected]>
Sarah Abderemane <https://github.com/sabderemane>
Sarah Boyce <https://github.com/sarahboyce>
Sarthak Mehrish <[email protected]>
[email protected]
Expand Down
5 changes: 0 additions & 5 deletions django/contrib/admin/static/admin/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/admin/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{% if not is_popup %}
<!-- Header -->
{% block header %}
<div id="header">
<header id="header">
<div id="branding">
{% block branding %}{% endblock %}
</div>
Expand Down Expand Up @@ -66,7 +66,7 @@
{% endif %}
{% endblock %}
{% block nav-global %}{% endblock %}
</div>
</header>
{% endblock %}
<!-- END Header -->
{% block nav-breadcrumbs %}
Expand Down
5 changes: 3 additions & 2 deletions docs/releases/5.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,13 @@ def test_enable_zooming_on_mobile(self):
'<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=[
Expand Down

0 comments on commit 814e7bc

Please sign in to comment.