Skip to content

Commit

Permalink
fix(pagination): fix aria label for pages to use total pages instead …
Browse files Browse the repository at this point in the history
…of total results

The `aria-label` for each page entry was of the form "page x of y" where y was the total number of
results, rather than the total number of pages. This PR fixes the error
  • Loading branch information
chrispymm committed Nov 22, 2024
1 parent 4c6c9b4 commit e12ddf5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/moj/components/pagination/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<li class="moj-pagination__item moj-pagination__item--dots">…</li>
{% else %}
{%- if item.selected %}
<li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ params.results.count }}" aria-current="page">{{ item.text }}</li>
<li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ params.items | length }}" aria-current="page">{{ item.text }}</li>
{% else %}
<li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ params.results.count }}">{{ item.text }}</a></li>
<li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ params.items | length }}">{{ item.text }}</a></li>
{% endif -%}
{% endif -%}
{% endfor -%}
Expand Down

0 comments on commit e12ddf5

Please sign in to comment.