Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Apply aria-live="polite" to announce range changes

Alexander Brandon Coles5b6348064271
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb
index 3756c01ce4d..0000bfefc4d 100644
--- a/app/helpers/pagination_helper.rb
+++ b/app/helpers/pagination_helper.rb
@@ -144,7 +144,12 @@ module PaginationHelper
content_tag(:ul, class: "op-pagination--items op-pagination--items_start", role: "presentation") do
concat will_paginate(paginator, **, container: false)
- concat content_tag(:li, "(#{page_first} - #{page_last}/#{total})", class: "op-pagination--range")
+ concat content_tag(
+ :li,
+ "(#{page_first} - #{page_last}/#{total})",
+ class: "op-pagination--range",
+ aria: { live: "polite" }
+ )
end
end
diff --git a/frontend/src/app/shared/components/table-pagination/table-pagination.component.html b/frontend/src/app/shared/components/table-pagination/table-pagination.component.html
index ac7df72fd4c..20106162216 100644
--- a/frontend/src/app/shared/components/table-pagination/table-pagination.component.html
+++ b/frontend/src/app/shared/components/table-pagination/table-pagination.component.html
@@ -82,7 +82,7 @@
<svg chevron-right-icon size="xsmall" class="op-pagination--item-link-icon op-pagination--item-link-icon_next" />
</button>
</li>
- <li class="op-pagination--range">
+ <li class="op-pagination--range" aria-live="polite">
{{currentRange}}
<span *ngIf="pageNumbers.length === 1"
id="op-pagination-empty-text"
diff --git a/spec/helpers/pagination_helper_spec.rb b/spec/helpers/pagination_helper_spec.rb
index d471fe4c951..a51abf98ba2 100644
--- a/spec/helpers/pagination_helper_spec.rb
+++ b/spec/helpers/pagination_helper_spec.rb
@@ -116,7 +116,7 @@ RSpec.describe PaginationHelper do
it "shows the range of the entries displayed" do
range = "(#{(current_page * per_page) - per_page + 1} - " +
"#{current_page * per_page}/#{total_entries})"
- expect(pagination).to have_css(".op-pagination--range", text: range)
+ expect(pagination).to have_css(".op-pagination--range", text: range, aria: { live: "polite" })
end
it "has different urls if the params are specified as options" do