-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve pagination accessibility (#23962)
- Add `role="navigation"` An alternative is to wrap `<nav>` around, but that will shift the HTML structure - Add `aria-disabled="true"` for disabled items - Label previous/next page items with `aria-label` - Hide decoration arrows from screen-readers with `aria-hidden="true"` - Mark current page with `aria-current="page"`
- Loading branch information
1 parent
0d18dc3
commit d7cf66e
Showing
5 changed files
with
53 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 13 additions & 5 deletions
18
src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
@if ($paginator->hasPages()) | ||
<ul class="pagination"> | ||
<ul class="pagination" role="navigation"> | ||
{{-- Previous Page Link --}} | ||
@if ($paginator->onFirstPage()) | ||
<li class="page-item disabled"><span class="page-link">@lang('pagination.previous')</span></li> | ||
<li class="page-item disabled" aria-disabled="true"> | ||
<span class="page-link">@lang('pagination.previous')</span> | ||
</li> | ||
@else | ||
<li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a></li> | ||
<li class="page-item"> | ||
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a> | ||
</li> | ||
@endif | ||
|
||
{{-- Next Page Link --}} | ||
@if ($paginator->hasMorePages()) | ||
<li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a></li> | ||
<li class="page-item"> | ||
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a> | ||
</li> | ||
@else | ||
<li class="page-item disabled"><span class="page-link">@lang('pagination.next')</span></li> | ||
<li class="page-item disabled" aria-disabled="true"> | ||
<span class="page-link">@lang('pagination.next')</span> | ||
</li> | ||
@endif | ||
</ul> | ||
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters