Issue #3059232 by idebr, KelvinWong, keithnull, PCate, andrewmacpherson, huzooka, lauriii: Views mini pager Twig template has broken "aria-labelledby" reference

merge-requests/55/head
catch 2019-09-17 10:25:57 +01:00
parent c4e5c497da
commit 58abc5cdc1
4 changed files with 11 additions and 6 deletions

View File

@ -4,6 +4,7 @@
* Default theme implementation for a views mini-pager. * Default theme implementation for a views mini-pager.
* *
* Available variables: * Available variables:
* - heading_id: Pagination heading ID.
* - items: List of pager items. * - items: List of pager items.
* *
* @see template_preprocess_views_mini_pager() * @see template_preprocess_views_mini_pager()
@ -12,8 +13,8 @@
*/ */
#} #}
{% if items.previous or items.next %} {% if items.previous or items.next %}
<nav role="navigation" aria-labelledby="pagination-heading"> <nav role="navigation" aria-labelledby="{{ heading_id }}">
<h4 class="visually-hidden">{{ 'Pagination'|t }}</h4> <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
<ul class="js-pager__items"> <ul class="js-pager__items">
{% if items.previous %} {% if items.previous %}
<li> <li>

View File

@ -1034,6 +1034,8 @@ function template_preprocess_views_mini_pager(&$variables) {
// This is based on the entire current query string. We need to ensure // This is based on the entire current query string. We need to ensure
// cacheability is affected accordingly. // cacheability is affected accordingly.
$variables['#cache']['contexts'][] = 'url.query_args'; $variables['#cache']['contexts'][] = 'url.query_args';
$variables['heading_id'] = Html::getUniqueId('pagination-heading');
} }
/** /**

View File

@ -4,14 +4,15 @@
* Theme override for a views mini-pager. * Theme override for a views mini-pager.
* *
* Available variables: * Available variables:
* - heading_id: Pagination heading ID.
* - items: List of pager items. * - items: List of pager items.
* *
* @see template_preprocess_views_mini_pager() * @see template_preprocess_views_mini_pager()
*/ */
#} #}
{% if items.previous or items.next %} {% if items.previous or items.next %}
<nav class="pager" role="navigation" aria-labelledby="pagination-heading"> <nav class="pager" role="navigation" aria-labelledby="{{ heading_id }}">
<h4 class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4> <h4 id="{{ heading_id }}" class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4>
<ul class="pager__items js-pager__items"> <ul class="pager__items js-pager__items">
{% if items.previous %} {% if items.previous %}
<li class="pager__item pager__item--previous"> <li class="pager__item pager__item--previous">

View File

@ -4,14 +4,15 @@
* Theme override for a views mini-pager. * Theme override for a views mini-pager.
* *
* Available variables: * Available variables:
* - heading_id: Pagination heading ID.
* - items: List of pager items. * - items: List of pager items.
* *
* @see template_preprocess_views_mini_pager() * @see template_preprocess_views_mini_pager()
*/ */
#} #}
{% if items.previous or items.next %} {% if items.previous or items.next %}
<nav role="navigation" aria-labelledby="pagination-heading"> <nav role="navigation" aria-labelledby="{{ heading_id }}">
<h4 class="visually-hidden">{{ 'Pagination'|t }}</h4> <h4 id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</h4>
<ul class="js-pager__items"> <ul class="js-pager__items">
{% if items.previous %} {% if items.previous %}
<li> <li>