Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #35115 -- Made admin's footer render in <footer> tag. #17774

Merged
merged 5 commits into from Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions django/contrib/admin/static/admin/css/base.css
Expand Up @@ -893,11 +893,6 @@ a.deletelink:focus, a.deletelink:hover {
}
}

#footer {
clear: both;
padding: 10px;
}
MHLut marked this conversation as resolved.
Show resolved Hide resolved

/* COLUMN TYPES */

.colMS {
Expand Down
6 changes: 1 addition & 5 deletions django/contrib/admin/static/admin/css/responsive.css
Expand Up @@ -451,14 +451,10 @@ input[type="submit"], button {
@media (max-width: 767px) {
/* Layout */

#header, #content, #footer {
#header, #content {
padding: 15px;
}

#footer:empty {
padding: 0;
}

div.breadcrumbs {
padding: 10px 15px;
}
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/templates/admin/base.html
Expand Up @@ -108,9 +108,9 @@
<br class="clear">
</div>
<!-- END Content -->
{% block footer %}<div id="footer"></div>{% endblock %}
</main>
</div>
<footer id="footer">{% block footer %}{% endblock %}</footer>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a small test? For example:

diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index cb61c88941..429a79c062 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1605,6 +1605,10 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
             '<main id="content-start" class="content" tabindex="-1">',
         )
 
+    def test_footer(self):
+        response = self.client.get(reverse("admin:index"))
+        self.assertContains(response, '<footer id="footer">')
+
     def test_aria_describedby_for_add_and_change_links(self):
         response = self.client.get(reverse("admin:index"))
         tests = [

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I added a test based on the existing header test!

</div>
<!-- END Container -->

Expand Down
4 changes: 4 additions & 0 deletions docs/releases/5.1.txt
Expand Up @@ -348,6 +348,10 @@ Miscellaneous
* In order to improve accessibility, the admin's changelist filter is now
rendered in a ``<nav>`` tag instead of a ``<div>``.

* In order to improve accessibility, the admin's footer is now rendered in
a ``<footer>`` tag instead of a ``<div>``, and also moved below the
``<div id="main">`` element.

* :meth:`.SimpleTestCase.assertURLEqual` and
:meth:`~django.test.SimpleTestCase.assertInHTML` now add ``": "`` to the
``msg_prefix``. This is consistent with the behavior of other assertions.
Expand Down
7 changes: 7 additions & 0 deletions tests/admin_views/tests.py
Expand Up @@ -1605,6 +1605,13 @@ def test_main_content(self):
'<main id="content-start" class="content" tabindex="-1">',
)

def test_footer(self):
response = self.client.get(reverse("admin:index"))
self.assertContains(response, '<footer id="footer">')
self.client.logout()
response = self.client.get(reverse("admin:login"))
self.assertContains(response, '<footer id="footer">')

def test_aria_describedby_for_add_and_change_links(self):
response = self.client.get(reverse("admin:index"))
tests = [
Expand Down