From e9cde2970a449c01b1d93fd983d7e3fb29e0df2c Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Wed, 25 Jan 2023 21:21:06 -0600
Subject: [PATCH] Revert "Issue #3333401 by nicxvan, bnjmnm: Pager h4 causes
 accessibility flag on many pages"

This reverts commit 78cf3677d3fa44e79aa710bf1470f6bbec800e7f.
---
 core/modules/system/templates/pager.html.twig                  | 3 ++-
 core/modules/views/templates/views-mini-pager.html.twig        | 3 ++-
 .../umami/templates/classy/views/views-mini-pager.html.twig    | 3 ++-
 core/themes/claro/templates/pager.html.twig                    | 3 ++-
 core/themes/claro/templates/views/views-mini-pager.html.twig   | 3 ++-
 core/themes/olivero/templates/navigation/pager.html.twig       | 3 ++-
 core/themes/olivero/templates/views/views-mini-pager.html.twig | 3 ++-
 .../starterkit_theme/templates/navigation/pager.html.twig      | 3 ++-
 .../templates/views/views-mini-pager.html.twig                 | 3 ++-
 9 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/core/modules/system/templates/pager.html.twig b/core/modules/system/templates/pager.html.twig
index 7e2a539267f7..affc1e53a354 100644
--- a/core/modules/system/templates/pager.html.twig
+++ b/core/modules/system/templates/pager.html.twig
@@ -33,7 +33,8 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {# Print first item if we are not on the first page. #}
       {% if items.first %}
diff --git a/core/modules/views/templates/views-mini-pager.html.twig b/core/modules/views/templates/views-mini-pager.html.twig
index d3aa58f31484..b18eaef98ef0 100644
--- a/core/modules/views/templates/views-mini-pager.html.twig
+++ b/core/modules/views/templates/views-mini-pager.html.twig
@@ -13,7 +13,8 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="js-pager__items">
       {% if items.previous %}
         <li>
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/views/views-mini-pager.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/views/views-mini-pager.html.twig
index be410660afbc..4b46f2bb1f69 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/views/views-mini-pager.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/views/views-mini-pager.html.twig
@@ -11,7 +11,8 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {% if items.previous %}
         <li class="pager__item pager__item--previous">
diff --git a/core/themes/claro/templates/pager.html.twig b/core/themes/claro/templates/pager.html.twig
index 8fc18cd78c54..e91a3ff031a1 100644
--- a/core/themes/claro/templates/pager.html.twig
+++ b/core/themes/claro/templates/pager.html.twig
@@ -35,7 +35,8 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {# Print first item if we are not on the first page. #}
       {% if items.first %}
diff --git a/core/themes/claro/templates/views/views-mini-pager.html.twig b/core/themes/claro/templates/views/views-mini-pager.html.twig
index c4ba977661e0..c84eb710c9cb 100644
--- a/core/themes/claro/templates/views/views-mini-pager.html.twig
+++ b/core/themes/claro/templates/views/views-mini-pager.html.twig
@@ -18,7 +18,8 @@
   ]
 %}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav{{ attributes.addClass('pager').setAttribute('role', 'navigation').setAttribute('aria-labelledby', heading_id) }}>
+    <h4{{ title_attributes.addClass('visually-hidden').setAttribute('id', heading_id) }}>{{ 'Pagination'|t }}</h4>
     <ul{{ content_attributes.addClass('pager__items', 'js-pager__items') }}>
       {% if items.previous %}
         {% apply spaceless %}
diff --git a/core/themes/olivero/templates/navigation/pager.html.twig b/core/themes/olivero/templates/navigation/pager.html.twig
index 88de15e3b918..29d011513e10 100644
--- a/core/themes/olivero/templates/navigation/pager.html.twig
+++ b/core/themes/olivero/templates/navigation/pager.html.twig
@@ -31,7 +31,8 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager layout--content-medium" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {# Print first item if we are not on the first page. #}
       {% if items.first %}
diff --git a/core/themes/olivero/templates/views/views-mini-pager.html.twig b/core/themes/olivero/templates/views/views-mini-pager.html.twig
index 2e905c41ebe8..a9acc73a0026 100644
--- a/core/themes/olivero/templates/views/views-mini-pager.html.twig
+++ b/core/themes/olivero/templates/views/views-mini-pager.html.twig
@@ -11,7 +11,8 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {# Print previous item if we are not on the first page. #}
       {% if items.previous %}
diff --git a/core/themes/starterkit_theme/templates/navigation/pager.html.twig b/core/themes/starterkit_theme/templates/navigation/pager.html.twig
index d4480a37a03b..6f863faaf912 100644
--- a/core/themes/starterkit_theme/templates/navigation/pager.html.twig
+++ b/core/themes/starterkit_theme/templates/navigation/pager.html.twig
@@ -31,7 +31,8 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {# Print first item if we are not on the first page. #}
       {% if items.first %}
diff --git a/core/themes/starterkit_theme/templates/views/views-mini-pager.html.twig b/core/themes/starterkit_theme/templates/views/views-mini-pager.html.twig
index be410660afbc..4b46f2bb1f69 100644
--- a/core/themes/starterkit_theme/templates/views/views-mini-pager.html.twig
+++ b/core/themes/starterkit_theme/templates/views/views-mini-pager.html.twig
@@ -11,7 +11,8 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
+  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
+    <h4 id="{{ heading_id }}" class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4>
     <ul class="pager__items js-pager__items">
       {% if items.previous %}
         <li class="pager__item pager__item--previous">
-- 
GitLab