From d6a990b8e6b4f4451915ca0b7fec8d25fbd4b73d Mon Sep 17 00:00:00 2001
From: Lauri Eskola <lauri.eskola@acquia.com>
Date: Fri, 8 Sep 2023 09:59:55 +0300
Subject: [PATCH] Issue #3384679 by Gauravvvv, kostyashupenko, neclimdul,
 PickyOrder, mgifford: aria-current is giving an invalid value

---
 core/includes/theme.inc                                        | 3 +--
 .../system/tests/src/Unit/Pager/PreprocessPagerTest.php        | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 2692d6bed1d0..43b96e1e08eb 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -9,7 +9,6 @@
  */
 
 use Drupal\Component\Render\FormattableMarkup;
-use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Core\Url;
 use Drupal\Component\Serialization\Json;
 use Drupal\Component\Utility\Crypt;
@@ -1837,7 +1836,7 @@ function template_preprocess_pager(&$variables) {
     $items['pages'][$i]['attributes'] = new Attribute();
     if ($i == $pager_current) {
       $variables['current'] = $i;
-      $items['pages'][$i]['attributes']->setAttribute('aria-current', new TranslatableMarkup('Current page'));
+      $items['pages'][$i]['attributes']->setAttribute('aria-current', 'page');
     }
   }
   // Add an ellipsis if there are further next pages.
diff --git a/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php b/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php
index 4623ffc9c7d4..cf210b4ec8aa 100644
--- a/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php
+++ b/core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php
@@ -88,7 +88,7 @@ public function testQuantitySet() {
     /** @var \Drupal\Core\Template\AttributeString $attribute */
     $attribute = $variables['items']['pages']['2']['attributes']->offsetGet('aria-current');
     $this->assertInstanceOf(AttributeString::class, $attribute);
-    $this->assertEquals('Current page', $attribute->value());
+    $this->assertEquals('page', $attribute->value());
   }
 
 }
-- 
GitLab