From 01de0a8421928fd43e61645c468cb3d1f52f330c Mon Sep 17 00:00:00 2001
From: Lauri Eskola <lauri.eskola@acquia.com>
Date: Wed, 25 Jan 2023 12:03:43 +0200
Subject: [PATCH] Issue #3333401 by nicxvan, bnjmnm: Pager h4 causes
 accessibility flag on many pages

---
 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, 9 insertions(+), 18 deletions(-)

diff --git a/core/modules/system/templates/pager.html.twig b/core/modules/system/templates/pager.html.twig
index affc1e53a354..7e2a539267f7 100644
--- a/core/modules/system/templates/pager.html.twig
+++ b/core/modules/system/templates/pager.html.twig
@@ -33,8 +33,7 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 b18eaef98ef0..d3aa58f31484 100644
--- a/core/modules/views/templates/views-mini-pager.html.twig
+++ b/core/modules/views/templates/views-mini-pager.html.twig
@@ -13,8 +13,7 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 4b46f2bb1f69..be410660afbc 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,8 +11,7 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 e91a3ff031a1..8fc18cd78c54 100644
--- a/core/themes/claro/templates/pager.html.twig
+++ b/core/themes/claro/templates/pager.html.twig
@@ -35,8 +35,7 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 c84eb710c9cb..c4ba977661e0 100644
--- a/core/themes/claro/templates/views/views-mini-pager.html.twig
+++ b/core/themes/claro/templates/views/views-mini-pager.html.twig
@@ -18,8 +18,7 @@
   ]
 %}
 {% if items.previous or items.next %}
-  <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>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 29d011513e10..88de15e3b918 100644
--- a/core/themes/olivero/templates/navigation/pager.html.twig
+++ b/core/themes/olivero/templates/navigation/pager.html.twig
@@ -31,8 +31,7 @@
  */
 #}
 {% if items %}
-  <nav class="pager layout--content-medium" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 a9acc73a0026..2e905c41ebe8 100644
--- a/core/themes/olivero/templates/views/views-mini-pager.html.twig
+++ b/core/themes/olivero/templates/views/views-mini-pager.html.twig
@@ -11,8 +11,7 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 6f863faaf912..d4480a37a03b 100644
--- a/core/themes/starterkit_theme/templates/navigation/pager.html.twig
+++ b/core/themes/starterkit_theme/templates/navigation/pager.html.twig
@@ -31,8 +31,7 @@
  */
 #}
 {% if items %}
-  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <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 4b46f2bb1f69..be410660afbc 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,8 +11,7 @@
  */
 #}
 {% if items.previous or items.next %}
-  <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
-    <h4 id="{{ heading_id }}" class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4>
+  <nav class="pager" role="navigation" aria-label="{{ 'Pagination'|t }}">
     <ul class="pager__items js-pager__items">
       {% if items.previous %}
         <li class="pager__item pager__item--previous">
-- 
GitLab