Skip to content

Commit

Permalink
Added accessibility for the pagination snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
littlesvensson committed Jan 17, 2025
1 parent 4789d4b commit 141958f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions dojo/templates/dojo/paging_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
{% endblocktrans %}
</div>

<nav class="pull-right">
<nav class="pull-right" aria-label="Pagination navigation">
<ul class="pagination pagination-sm">
{% if page.has_other_pages %}
{% for num in page|paginate:5 %}
<li {% if num.is_current %}class="active"{% endif %}>
{% if num.page_number %}
<a href="?{% url_replace request page_param num.page_number %}"> {{ num.display }}</a>
<a href="?{% url_replace request page_param num.page_number %}" aria-label="{% trans 'Page' %} {{ num.display }}"> {{ num.display }}</a>
{% else %}
<a>{{ num.display }}</a>
<a href="#" role="presentation" aria-disabled="true" tabindex="-1">{{ num.display }}</a>
{% endif %}
</li>
{% endfor %}
Expand All @@ -28,21 +28,21 @@
<!-- Split button -->
&nbsp;
<div class="btn-group">
<button type="button" class="btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="{% trans 'Page size selector' %}" id="pageSizeDropdown" class="btn-sm btn-secondary dropdown-toggle" type="button">
{% trans "Page Size" %}
<span class="caret"></span>
<span class="sr-only">{% trans "Toggle Dropdown" %}</span>
</button>
<ul class="dropdown-menu">
<li><a href="?{% url_replace request page_size_param 25 %}">25</a></li>
<li><a href="?{% url_replace request page_size_param 50 %}">50</a></li>
<li><a href="?{% url_replace request page_size_param 75 %}">75</a></li>
<li><a href="?{% url_replace request page_size_param 100 %}">100</a></li>
<li><a href="?{% url_replace request page_size_param 150 %}">150</a></li>
<ul class="dropdown-menu" role="menu" aria-labelledby="pageSizeDropdown">
<li role="presentation"><a href="?{% url_replace request page_size_param 25 %}" aria-label="{% trans '25 items per page' %}" role="menuitem">25</a></li>
<li role="presentation"><a href="?{% url_replace request page_size_param 50 %}" aria-label="{% trans '50 items per page' %}" role="menuitem">50</a></li>
<li role="presentation"><a href="?{% url_replace request page_size_param 75 %}" aria-label="{% trans '75 items per page' %}" role="menuitem" >75</a></li>
<li role="presentation"><a href="?{% url_replace request page_size_param 100 %}" aria-label="{% trans '100 items per page' %}" role="menuitem">100</a></li>
<li role="presentation"><a href="?{% url_replace request page_size_param 150 %}" aria-label="{% trans '150 items per page' %}" role="menuitem">150</a></li>
{% if page.paginator.count > 500 %}
<li><a href="?{% url_replace request page_size_param 500 %}">500</a></li>
<li role="presentation"><a href="?{% url_replace request page_size_param 500 %}" aria-label="{% trans '500 items per page' %}" role="menuitem" >500</a></li>
{% endif %}
<li><a href="?{% url_replace request page_size_param page.paginator.count %}">{% trans "All" %}</a></li>
<li role="presentation"><a href="?{% url_replace request page_size_param page.paginator.count %}" aria-label="{% trans 'All items per page' %}" role="menuitem">{% trans "All" %}</a></li>
</ul>
</div>
</li>
Expand Down

0 comments on commit 141958f

Please sign in to comment.