From b071123bff9fe168edc76ddf73963c6b3cece97f Mon Sep 17 00:00:00 2001 From: Vanita Barrett Date: Thu, 12 Sep 2019 12:17:10 +0100 Subject: [PATCH] Use h2 if there's no contents list 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. --- app/presenters/document_collection_presenter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/presenters/document_collection_presenter.rb b/app/presenters/document_collection_presenter.rb index b8901e3e7..e34f39eda 100644 --- a/app/presenters/document_collection_presenter.rb +++ b/app/presenters/document_collection_presenter.rb @@ -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