Make links to annotation comments accessible
The link to the comments page was an "expand" icon, which was confusing because it wasn't really expanding the contents of the sidebar but going to an entirely different page. Furthermore, it didn't have any text for people using screen readers, which is why Axe was reporting the following accessibility error: ``` link-name: Links must have discernible text (serious) https://dequeuniversity.com/rules/axe/4.10/link-name?application=axeAPI The following 1 node violate this rule: Selector: #annotation-link > a HTML: <a href="/legislation/processes/75/draft_versions/30/annotations/8?sub_annotation_ids="> <span class="icon-expand" aria-hidden="true"></span> </a> Fix all of the following: - Element is in tab order and does not have accessible text Fix any of the following: - Element does not have text that is visible to screen readers - aria-label attribute does not exist or is empty - aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty - Element has no title attribute ``` So we're removing the icon and turning the "N comments" text into a link, so it's easier to guess that the link takes us to the page showing all the comments for this annotation.
This commit is contained in:
@@ -596,12 +596,6 @@
|
||||
border-bottom: 1px solid $border;
|
||||
margin-bottom: rem-calc(16);
|
||||
padding-bottom: rem-calc(8);
|
||||
|
||||
a .icon-expand {
|
||||
color: #838383;
|
||||
float: right;
|
||||
font-size: $small-font-size;
|
||||
}
|
||||
}
|
||||
|
||||
.comments-wrapper {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<%= link_to legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation, sub_annotation_ids: "") do %>
|
||||
<span class="icon-expand" aria-hidden="true"></span>
|
||||
<% end %>
|
||||
@@ -1,5 +1,8 @@
|
||||
<%= render Shared::CommentsCountComponent.new(annotation.comments.roots.count) %>
|
||||
|
||||
<span id="annotation-link" data-sub-annotation-ids="8">
|
||||
<%= render "annotation_link", annotation: annotation %>
|
||||
<%= render Shared::CommentsCountComponent.new(
|
||||
annotation.comments.roots.count,
|
||||
url: legislation_process_draft_version_annotation_path(
|
||||
annotation.draft_version.process, annotation.draft_version, annotation, sub_annotation_ids: ""
|
||||
)
|
||||
) %>
|
||||
</span>
|
||||
|
||||
@@ -14,11 +14,11 @@ if ($(".comment").length == 0) {
|
||||
|
||||
$("#annotation-link a").attr("href", new_annotation_link)
|
||||
|
||||
var current_comment_text = $(".comments-count").text()
|
||||
var current_comment_text = $("#annotation-link a").text()
|
||||
var current_comment_count = current_comment_text.match(/\d+/)[0]
|
||||
var new_comment_count = parseInt(current_comment_count) + parseInt(<%= @annotation.comments.roots.count %>)
|
||||
var new_comment_count_text = current_comment_text.replace(/(\d+)/, new_comment_count);
|
||||
$(".comments-count").text(new_comment_count_text)
|
||||
$("#annotation-link a").text(new_comment_count_text)
|
||||
}
|
||||
|
||||
<%= render "comments_box_form", comment: @comment, annotation: @annotation %>
|
||||
|
||||
@@ -35,9 +35,7 @@ describe "Commenting legislation annotations" do
|
||||
end
|
||||
|
||||
scenario "View comments of annotations in an included range" do
|
||||
within("#annotation-link") do
|
||||
find(".icon-expand").click
|
||||
end
|
||||
click_link "2 comment"
|
||||
|
||||
expect(page).to have_content "Comments about"
|
||||
expect(page).to have_css ".comment", count: 2
|
||||
@@ -71,20 +69,16 @@ describe "Commenting legislation annotations" do
|
||||
expect(page).to have_content "my other annotation"
|
||||
end
|
||||
|
||||
within("#annotation-link") do
|
||||
find(".icon-expand").click
|
||||
end
|
||||
click_link "2 comment"
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("my annotation")
|
||||
expect(page).to have_content("my other annotation")
|
||||
expect(page).to have_content("replying in single annotation thread")
|
||||
expect(page).to have_css ".comment", count: 3
|
||||
expect(page).to have_content "my annotation"
|
||||
expect(page).to have_content "my other annotation"
|
||||
expect(page).to have_content "replying in single annotation thread"
|
||||
end
|
||||
|
||||
scenario "Reply on a multiple annotation thread and display it in the single annotation thread" do
|
||||
within("#annotation-link") do
|
||||
find(".icon-expand").click
|
||||
end
|
||||
click_link "2 comment"
|
||||
|
||||
within("#comment_#{comment2.id}") do
|
||||
click_link "Reply"
|
||||
|
||||
Reference in New Issue
Block a user