-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add aria-rowindex attributes to table rows for improved screen reader…
… accessibility
- Loading branch information
Showing
17 changed files
with
336 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,58 @@ | ||
<tbody class="govuk-table__body" data-cy-case-id="<%= investigation.pretty_id %>"> | ||
<tr class="govuk-table__row"> | ||
<th class="govuk-visually-hidden"> | ||
Notification title | ||
</th> | ||
<th id="<%= dom_id investigation, :item %>" colspan="5" scope="colgroup" class="govuk-table__header"> | ||
<%= link_to sanitize(investigation.title), investigation_path(investigation), class: "govuk-link govuk-link--no-visited-state" %> | ||
<tr class="govuk-table__row" id="<%= dom_id investigation, :title %>" aria-rowindex="<%= calculate_row_index(investigation_counter, 1) %>"> | ||
<th scope="row" class="govuk-table__header" colspan="5" headers="case"> | ||
<span id="desc-<%= investigation.id %>" class="govuk-visually-hidden"> | ||
Notification number: <%= investigation.pretty_id %>. | ||
<%= non_search_cases_page_names.include?(@page_name) ? "Created: #{investigation.created_at.to_formatted_s(:govuk)}" : "Owner: #{investigation_owner(investigation)}" %>. | ||
<%= @page_name == "assigned_cases" ? "Assigner: #{sanitize(investigation.owner_team&.name)}" : "Hazard type: #{sanitize(investigation.hazard_type.presence || "Not provided")}" %>. | ||
Product count: <%= pluralize investigation.products.count, "product" %>. | ||
<%= sorted_by == SortByHelper::SORT_BY_CREATED_AT ? "Created: #{time_ago_in_words(investigation.created_at)} ago" : "Updated: #{date_or_recent_time_ago investigation.updated_at}" %>. | ||
</span> | ||
<%= link_to sanitize(investigation.title), investigation_path(investigation), class: "govuk-link govuk-link--no-visited-state", "aria-describedby": "desc-#{investigation.id}" %> | ||
</th> | ||
</tr> | ||
<tr class="govuk-table__row"> | ||
<th headers="<%= dom_id investigation, :item %>" id="<%= dom_id investigation, :meta %>" class="govuk-visually-hidden"> | ||
<tr class="govuk-table__row" id="<%= dom_id investigation, :meta %>" aria-rowindex="<%= calculate_row_index(investigation_counter, 2) %>"> | ||
<th headers="case" id="<%= dom_id investigation, :meta_header %>" class="govuk-visually-hidden"> | ||
Metadata | ||
</th> | ||
<td headers="case <%= dom_id investigation, :item %> <%= dom_id investigation, :meta %>" class="govuk-table__cell"> | ||
<td headers="case <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= investigation.pretty_id %> | ||
</td> | ||
|
||
<% if non_search_cases_page_names.include? @page_name %> | ||
<td headers="casecreated <%= dom_id investigation, :item %> <%= dom_id investigation, :meta %>" class="govuk-table__cell"> | ||
<td headers="casecreated <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= investigation.created_at.to_formatted_s(:govuk) %> | ||
</td> | ||
<% else %> | ||
<td headers="caseowner <%= dom_id investigation, :item %> <%= dom_id investigation, :meta %>" class="govuk-table__cell"> | ||
<%= sanitize(investigation.owner_display_name_for(viewer: current_user)) %> | ||
<td headers="caseowner <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= investigation_owner(investigation) %> | ||
</td> | ||
<% end %> | ||
|
||
<% if @page_name == "assigned_cases" %> | ||
<td headers="assigner" class="govuk-table__cell"> | ||
<td headers="assigner <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= sanitize(investigation.owner_team&.name) %> | ||
</td> | ||
<% else %> | ||
<td headers="haztype" class="govuk-table__cell"> | ||
<td headers="haztype <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= sanitize(investigation.hazard_type.presence || "Not provided") %> | ||
</td> | ||
<% end %> | ||
|
||
<td headers="product_count" class="govuk-table__cell"> | ||
<td headers="prodcount <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= pluralize investigation.products.count, "product" %> | ||
</td> | ||
|
||
<% if sorted_by == SortByHelper::SORT_BY_CREATED_AT %> | ||
<td headers="created <%= dom_id investigation, :item %> <%= dom_id investigation, :meta %>" class="govuk-table__cell"> | ||
<td headers="created <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= "#{time_ago_in_words(investigation.created_at)} ago" %> | ||
</td> | ||
<% else %> | ||
<td headers="updated <%= dom_id investigation, :item %> <%= dom_id investigation, :meta %>" class="govuk-table__cell"> | ||
<td headers="updated <%= dom_id investigation, :meta_header %>" class="govuk-table__cell"> | ||
<%= date_or_recent_time_ago investigation.updated_at %> | ||
</td> | ||
<% end %> | ||
</tr> | ||
|
||
<%= render "investigations/status_table_row", investigation: investigation %> | ||
<%= render "investigations/status_table_row", investigation: investigation, investigation_counter: investigation_counter %> | ||
</tbody> |
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<% | ||
status_class = case investigation.status | ||
when "open" | ||
"govuk-tag--blue" | ||
when "closed" | ||
"govuk-tag--red" | ||
else | ||
"govuk-tag--grey" | ||
end | ||
%> | ||
<strong class="govuk-tag <%= status_class %>" aria-label="Status: <%= investigation.status %>"> | ||
<%= investigation.status.titleize %> | ||
</strong> |
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,5 +1,5 @@ | ||
<% if policy(investigation).view_non_protected_details? %> | ||
<%= render "investigations/full_table_body", investigation: investigation.decorate, sorted_by: sorted_by, page_name: page_name %> | ||
<%= render "investigations/full_table_body", investigation: investigation.decorate, sorted_by: sorted_by, page_name: page_name, investigation_counter: investigation_counter %> | ||
<% else %> | ||
<%= render "investigations/restricted_table_body", investigation: investigation.decorate, page_name: page_name %> | ||
<%= render "investigations/restricted_table_body", investigation: investigation.decorate, page_name: page_name, investigation_counter: investigation_counter %> | ||
<% end %> |
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
Oops, something went wrong.