diff --git a/app/views/govuk_publishing_components/components/_layout_header.html.erb b/app/views/govuk_publishing_components/components/_layout_header.html.erb
index e5bfbcb31b..f7043a703c 100644
--- a/app/views/govuk_publishing_components/components/_layout_header.html.erb
+++ b/app/views/govuk_publishing_components/components/_layout_header.html.erb
@@ -5,7 +5,7 @@
search ||= false
search_left ||= false
navigation_items ||= []
- navigation_items_label ||= false
+ navigation_aria_label ||= "Top level"
remove_bottom_border ||= false
search_left ||= false
width_class = full_width ? "govuk-header__container--full-width" : "govuk-width-container"
@@ -29,7 +29,7 @@
<%= render "govuk_publishing_components/components/layout_header/search" %>
- <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_items_label: navigation_items_label %>
+ <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
<% else %>
@@ -38,7 +38,7 @@
<%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
<% if search %>
diff --git a/app/views/govuk_publishing_components/components/docs/layout_header.yml b/app/views/govuk_publishing_components/components/docs/layout_header.yml
index 1f2c6e783d..1afffe1c37 100644
--- a/app/views/govuk_publishing_components/components/docs/layout_header.yml
+++ b/app/views/govuk_publishing_components/components/docs/layout_header.yml
@@ -64,7 +64,7 @@ examples:
description: The navigation has `aria-label="Top level"` by default. This option is here for when the `aria-label` needs to be more descriptive than that.
data:
search_left: true
- navigation_items_label: "Departments and policy"
+ navigation_aria_label: "Departments and policy"
navigation_items:
- text: Departments
href: "item-1"
diff --git a/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb b/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb
index 6d51605e5e..84c8a61ec5 100644
--- a/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb
+++ b/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb
@@ -1,18 +1,17 @@
-<% navigation_items_label ||= "Top level" %>
<% if navigation_items.any? %>
-
+ <% end %>
<% end %>
diff --git a/spec/components/layout_header_spec.rb b/spec/components/layout_header_spec.rb
index b3b352b888..0f734c7e85 100644
--- a/spec/components/layout_header_spec.rb
+++ b/spec/components/layout_header_spec.rb
@@ -64,14 +64,14 @@ def component_name
assert_select ".gem-c-header__nav[aria-label='Top level']"
end
- it "renders the header navigation items with custom aria-label when navigation_items_label is specified" do
+ it "renders the header navigation items with custom aria-label when navigation_aria_label is specified" do
navigation_items = [
{ text: "Foo", href: "/foo", active: true },
{ text: "Bar", href: "/bar" },
{ text: "Hello", href: "/hello", show_only_in_collapsed_menu: true },
]
- render_component(environment: "staging", navigation_items: navigation_items, navigation_items_label: "My fancy label")
+ render_component(environment: "staging", navigation_items: navigation_items, navigation_aria_label: "My fancy label")
assert_select ".gem-c-header__nav[aria-label='My fancy label']"
end