Skip to content

Commit

Permalink
Use h2 if there's no contents list
Browse files Browse the repository at this point in the history
When the contents list component doesn't display (if there's 2 groups or less), then the heading level skips from H1 (page title) to H3 (group headings).

Someone raised this issue in a Zendesk ticket: https://govuk.zendesk.com/agent/tickets/3800830

This commit checks whether a contents list will be displayed, and uses a H2 if not.
  • Loading branch information
Vanita Barrett committed Sep 12, 2019
1 parent 38dc142 commit b071123
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/presenters/document_collection_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def group_document_links(group, group_index)

def group_heading(group)
title = group["title"]
content_tag :h3, title, class: "group-title", id: group_title_id(title)
heading_level = show_contents_list? ? :h3 : :h2
content_tag heading_level, title, class: "group-title", id: group_title_id(title)
end

private
Expand Down

0 comments on commit b071123

Please sign in to comment.