Skip to content

Commit a983689

Browse files
author
Marvin Kuhn
committed
fixed #2 added aria labels and navigation role
1 parent 5e9f0c7 commit a983689

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

Configuration/Settings.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Neos:
1111
fusion:
1212
autoInclude:
1313
Breadlesscode.Listable: true
14+
userInterface:
15+
translation:
16+
autoInclude:
17+
'Breadlesscode.Listable':
18+
- '*'
1419
Breadlesscode:
1520
Listable:
1621
pagination:

Resources/Private/Fusion/Component/Pagination.fusion

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ prototype(Breadlesscode.Listable:Pagination) < prototype(Neos.Fusion:Component)
55
itemsPerPage = ''
66
paginationConfig = ${ [] }
77

8-
@process.wrapPagination = ${ '<ul class="pagination">' + value + '</ul>' }
8+
@process.wrapPaginationUl = ${ '<ul class="pagination">' + value + '</ul>' }
9+
@process.wrapPaginationNav = ${ '<nav role="navigation" aria-label="Pagination Navigation">' + value + '</nav>' }
910
@if.hasOnlyOnePage = ${ this.totalCount > this.itemsPerPage }
1011

1112
renderer = Neos.Fusion:Collection {
@@ -17,6 +18,8 @@ prototype(Breadlesscode.Listable:Pagination) < prototype(Neos.Fusion:Component)
1718
paginationConfig = ${ props.paginationConfig }
1819
}
1920
itemRenderer = Breadlesscode.Listable:PaginationItem {
21+
page = ${ item.page }
22+
isCurrent = ${ props.currentPage == item.page }
2023
uri = Neos.Neos:NodeUri {
2124
node = ${ documentNode }
2225
additionalParams = Neos.Fusion:RawArray {

Resources/Private/Fusion/Component/PaginationItem.fusion

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
prototype(Breadlesscode.Listable:PaginationItem) < prototype(Neos.Fusion:Component) {
22
label = ${ false }
33
uri = ${ false }
4+
page = ${ false }
5+
isCurrent = ${ false }
46
typeClass = ${ '' }
57
linkClass = 'page-link'
68

@@ -11,6 +13,12 @@ prototype(Breadlesscode.Listable:PaginationItem) < prototype(Neos.Fusion:Compone
1113
href = ${ props.uri }
1214
href.@if.hasUri = ${ props.uri ? true : false }
1315
class = ${ props.linkClass }
16+
17+
aria-label = ${ Translation.translate('Breadlesscode.Listable:Accessibility:item.label') + props.page }
18+
aria-label.@if.hasUri = ${ props.uri ? true : false }
19+
20+
aria-current= ${ "true" }
21+
aria-current.@if.isCurrent = ${ props.isCurrent }
1422
}
1523

1624
@process.itemWrap = Neos.Fusion:Tag {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file original="" product-name="Breadlesscode.Listable" source-language="en" target-language="de" datatype="plaintext">
4+
<body>
5+
<trans-unit id="label" xml:space="preserve">
6+
<source>Pagination Navigation</source>
7+
<target xml:lang="de">Seitennavigation</target>
8+
</trans-unit>
9+
<trans-unit id="item.label" xml:space="preserve">
10+
<source>Goto Page </source>
11+
<target xml:lang="de">Gehe zu Seite </target>
12+
</trans-unit>
13+
</body>
14+
</file>
15+
</xliff>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file original="" product-name="Breadlesscode.Listable" source-language="en" datatype="plaintext">
4+
<body>
5+
<trans-unit id="label" xml:space="preserve">
6+
<source>Pagination Navigation</source>
7+
</trans-unit>
8+
<trans-unit id="item.label" xml:space="preserve">
9+
<source>Goto Page </source>
10+
</trans-unit>
11+
</body>
12+
</file>
13+
</xliff>

0 commit comments

Comments
 (0)