Browse Source

Fixed #34833 -- Made admin's main content render in <main> tag.

Sarah Abderemane 1 year ago
parent
commit
91e617c743

+ 2 - 2
django/contrib/admin/templates/admin/base.html

@@ -81,7 +81,7 @@
     {% endblock %}
     {% endblock %}
     {% endif %}
     {% endif %}
 
 
-    <div class="main" id="main">
+    <main class="main" id="main">
       {% if not is_popup and is_nav_sidebar_enabled %}
       {% if not is_popup and is_nav_sidebar_enabled %}
         {% block nav-sidebar %}
         {% block nav-sidebar %}
           {% include "admin/nav_sidebar.html" %}
           {% include "admin/nav_sidebar.html" %}
@@ -110,7 +110,7 @@
         <!-- END Content -->
         <!-- END Content -->
         {% block footer %}<div id="footer"></div>{% endblock %}
         {% block footer %}<div id="footer"></div>{% endblock %}
       </div>
       </div>
-    </div>
+    </main>
 </div>
 </div>
 <!-- END Container -->
 <!-- END Container -->
 
 

+ 3 - 0
docs/releases/5.0.txt

@@ -622,6 +622,9 @@ Miscellaneous
   a page. Having two ``<h1>`` elements was confusing and the site header wasn't
   a page. Having two ``<h1>`` elements was confusing and the site header wasn't
   helpful as it is repeated on all pages.
   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>``.
+
 * On databases without native support for the SQL ``XOR`` operator, ``^`` as
 * On databases without native support for the SQL ``XOR`` operator, ``^`` as
   the exclusive or (``XOR``) operator now returns rows that are matched by an
   the exclusive or (``XOR``) operator now returns rows that are matched by an
   odd number of operands rather than exactly one operand. This is consistent
   odd number of operands rather than exactly one operand. This is consistent

+ 1 - 1
tests/admin_views/test_nav_sidebar.py

@@ -42,7 +42,7 @@ class AdminSidebarTests(TestCase):
 
 
     def test_sidebar_not_on_index(self):
     def test_sidebar_not_on_index(self):
         response = self.client.get(reverse("test_with_sidebar:index"))
         response = self.client.get(reverse("test_with_sidebar:index"))
-        self.assertContains(response, '<div class="main" id="main">')
+        self.assertContains(response, '<main class="main" id="main">')
         self.assertNotContains(
         self.assertNotContains(
             response, '<nav class="sticky" id="nav-sidebar" aria-label="Sidebar">'
             response, '<nav class="sticky" id="nav-sidebar" aria-label="Sidebar">'
         )
         )