Verified Commit ecac2516 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

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

parent b0bb1b47
Loading
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -165,8 +165,7 @@ public function testPagerHeadingLevel() {
    $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 @@ public function testPagerHeadingLevel() {
      $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());
    }
  }

}
+1 −2
Original line number Diff line number Diff line
@@ -400,8 +400,7 @@ public function testPagerHeadingLevel() {
    $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) {
+2 −1
Original line number Diff line number Diff line
@@ -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 %}
+2 −1
Original line number Diff line number Diff line
@@ -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>