Skip to content

Commit

Permalink
Fix usages of aria-labelledby
Browse files Browse the repository at this point in the history
These now conform to the W3C spec [1], which can be achieved
automatically by the correct use of a 'section' element [2].

[1] https://www.w3.org/TR/wai-aria/#region

[2] https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Region_role
  • Loading branch information
Ben Thorner committed Mar 26, 2020
1 parent a097b81 commit cda15fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions app/views/content_items/_attachments.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% attachment_title_id = "#{title.parameterize}-title" %>

<% if legacy_pre_rendered_documents.present? || attachments.any? %>
<%= render 'govuk_publishing_components/components/heading',
id: attachment_title_id,
text: title,
mobile_top_margin: true %>
<section aria-labelledby="<%= attachment_title_id %>">
<%= render 'govuk_publishing_components/components/heading',
id: attachment_title_id,
text: title,
mobile_top_margin: true %>

<div aria-labelledby="<%= attachment_title_id %>">
<% if legacy_pre_rendered_documents.present? %>
<%= render 'govuk_publishing_components/components/govspeak',
content: legacy_pre_rendered_documents.html_safe,
Expand All @@ -19,5 +19,5 @@
</div>
<% end %>
<% end %>
</div>
</section>
<% end %>
13 changes: 7 additions & 6 deletions app/views/content_items/publication.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@
legacy_pre_rendered_documents: @content_item.documents,
attachments: @content_item.featured_attachments %>

<%= render 'govuk_publishing_components/components/heading',
text: t("publication.details"),
id: "details-title",
mobile_top_margin: true %>

<div aria-labelledby="details-title">
<section aria-labelledby="details-title">
<%= render 'govuk_publishing_components/components/heading',
text: t("publication.details"),
id: "details-title",
mobile_top_margin: true %>

<%= render 'govuk_publishing_components/components/govspeak',
content: @content_item.details.html_safe,
direction: page_text_direction %>
</div>
</section>
</div>

<%= render 'components/published-dates', {
Expand Down

0 comments on commit cda15fc

Please sign in to comment.