Issue #3333418 by nicxvan, smustgrave, quietone: Fix pager h4 for accessibility on Stable9

merge-requests/5821/merge
nod_ 2024-03-03 01:24:13 +01:00
parent b0bb1b476a
commit ecac251678
No known key found for this signature in database
GPG Key ID: 76624892606FA197
4 changed files with 14 additions and 11 deletions

View File

@ -165,8 +165,7 @@ class MiniPagerTest extends ViewTestBase {
$view->display_handler->setOption('pager', $pager);
$view->save();
// Stark is handled below.
// Stable9 will be addressed in https://www.drupal.org/project/drupal/issues/3333418
// Stark and Stable9 are handled below.
$themes = ['olivero', 'claro', 'starterkit_theme'];
$this->container->get('theme_installer')->install($themes);
@ -176,11 +175,14 @@ class MiniPagerTest extends ViewTestBase {
$this->assertEquals('h3', $this->assertSession()->elementExists('css', ".pager .visually-hidden")->getTagName());
}
// The core views template uses a different class structure than core themes.
$this->container->get('theme_installer')->install(['stark']);
$this->config('system.theme')->set('default', 'stark')->save();
// The core views template and Stable9 use a different class structure than other core themes.
$themes = ['stark', 'stable9'];
$this->container->get('theme_installer')->install($themes);
foreach ($themes as $theme) {
$this->config('system.theme')->set('default', $theme)->save();
$this->drupalGet('test_mini_pager');
$this->assertEquals('h3', $this->assertSession()->elementExists('css', "#pagination-heading")->getTagName());
}
}
}

View File

@ -400,8 +400,7 @@ class PagerTest extends ViewTestBase {
$view->display_handler->setOption('pager', $pager);
$view->save();
// Stable9 will be addressed in https://www.drupal.org/project/drupal/issues/3333418
$themes = ['stark', 'olivero', 'claro', 'starterkit_theme'];
$themes = ['stark', 'olivero', 'claro', 'starterkit_theme', 'stable9'];
$this->container->get('theme_installer')->install($themes);
foreach ($themes as $theme) {

View File

@ -5,6 +5,7 @@
*
* Available variables:
* - heading_id: Pagination heading ID.
* - pagination_heading_level: The heading level to use for the pager.
* - items: List of pager items.
* The list is keyed by the following elements:
* - first: Item for the first page; not present on the first page of results.
@ -32,7 +33,7 @@
#}
{% if items %}
<nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
<h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
<{{ pagination_heading_level }} id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</{{ pagination_heading_level }}>
<ul class="pager__items js-pager__items">
{# Print first item if we are not on the first page. #}
{% if items.first %}

View File

@ -5,6 +5,7 @@
*
* Available variables:
* - heading_id: Pagination heading ID.
* - pagination_heading_level: The heading level to use for the pager.
* - items: List of pager items.
*
* @see template_preprocess_views_mini_pager()
@ -12,7 +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>
<{{ pagination_heading_level }} id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</{{ pagination_heading_level }}>
<ul class="js-pager__items">
{% if items.previous %}
<li>