From a9836892692b3044208708663ccfe056da264272 Mon Sep 17 00:00:00 2001 From: Marvin Kuhn Date: Sun, 8 Apr 2018 22:37:27 +0200 Subject: [PATCH] fixed #2 added aria labels and navigation role --- Configuration/Settings.yaml | 5 +++++ .../Private/Fusion/Component/Pagination.fusion | 5 ++++- .../Fusion/Component/PaginationItem.fusion | 8 ++++++++ .../Private/Translations/de/Accessibility.xlf | 15 +++++++++++++++ .../Private/Translations/en/Accessibility.xlf | 13 +++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Resources/Private/Translations/de/Accessibility.xlf create mode 100644 Resources/Private/Translations/en/Accessibility.xlf diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index b1e4775..55be8f7 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -11,6 +11,11 @@ Neos: fusion: autoInclude: Breadlesscode.Listable: true + userInterface: + translation: + autoInclude: + 'Breadlesscode.Listable': + - '*' Breadlesscode: Listable: pagination: diff --git a/Resources/Private/Fusion/Component/Pagination.fusion b/Resources/Private/Fusion/Component/Pagination.fusion index e2e8be4..f97c410 100644 --- a/Resources/Private/Fusion/Component/Pagination.fusion +++ b/Resources/Private/Fusion/Component/Pagination.fusion @@ -5,7 +5,8 @@ prototype(Breadlesscode.Listable:Pagination) < prototype(Neos.Fusion:Component) itemsPerPage = '' paginationConfig = ${ [] } - @process.wrapPagination = ${ '' } + @process.wrapPaginationUl = ${ '' } + @process.wrapPaginationNav = ${ '' } @if.hasOnlyOnePage = ${ this.totalCount > this.itemsPerPage } renderer = Neos.Fusion:Collection { @@ -17,6 +18,8 @@ prototype(Breadlesscode.Listable:Pagination) < prototype(Neos.Fusion:Component) paginationConfig = ${ props.paginationConfig } } itemRenderer = Breadlesscode.Listable:PaginationItem { + page = ${ item.page } + isCurrent = ${ props.currentPage == item.page } uri = Neos.Neos:NodeUri { node = ${ documentNode } additionalParams = Neos.Fusion:RawArray { diff --git a/Resources/Private/Fusion/Component/PaginationItem.fusion b/Resources/Private/Fusion/Component/PaginationItem.fusion index 7e306e9..23d34ce 100644 --- a/Resources/Private/Fusion/Component/PaginationItem.fusion +++ b/Resources/Private/Fusion/Component/PaginationItem.fusion @@ -1,6 +1,8 @@ prototype(Breadlesscode.Listable:PaginationItem) < prototype(Neos.Fusion:Component) { label = ${ false } uri = ${ false } + page = ${ false } + isCurrent = ${ false } typeClass = ${ '' } linkClass = 'page-link' @@ -11,6 +13,12 @@ prototype(Breadlesscode.Listable:PaginationItem) < prototype(Neos.Fusion:Compone href = ${ props.uri } href.@if.hasUri = ${ props.uri ? true : false } class = ${ props.linkClass } + + aria-label = ${ Translation.translate('Breadlesscode.Listable:Accessibility:item.label') + props.page } + aria-label.@if.hasUri = ${ props.uri ? true : false } + + aria-current= ${ "true" } + aria-current.@if.isCurrent = ${ props.isCurrent } } @process.itemWrap = Neos.Fusion:Tag { diff --git a/Resources/Private/Translations/de/Accessibility.xlf b/Resources/Private/Translations/de/Accessibility.xlf new file mode 100644 index 0000000..6471ebb --- /dev/null +++ b/Resources/Private/Translations/de/Accessibility.xlf @@ -0,0 +1,15 @@ + + + + + + Pagination Navigation + Seitennavigation + + + Goto Page + Gehe zu Seite + + + + \ No newline at end of file diff --git a/Resources/Private/Translations/en/Accessibility.xlf b/Resources/Private/Translations/en/Accessibility.xlf new file mode 100644 index 0000000..af3d51c --- /dev/null +++ b/Resources/Private/Translations/en/Accessibility.xlf @@ -0,0 +1,13 @@ + + + + + + Pagination Navigation + + + Goto Page + + + + \ No newline at end of file