Skip to content

Commit

Permalink
Merge pull request #251 from DFE-Digital/fix-breadcrumb-current-level…
Browse files Browse the repository at this point in the history
…-rendering-bug

Fix breadcrumb text entries when key is symbol
  • Loading branch information
peteryates authored Sep 13, 2021
2 parents 5d994f8 + 29f1742 commit d2e96b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/govuk_component/breadcrumbs_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def build_list_item(text, link = nil)
if link.present?
list_item { link_to(text, link, class: "govuk-breadcrumbs__link") }
else
list_item(aria: { current: "page" }) { text }
list_item(aria: { current: "page" }) { text.to_s }
end
end

Expand Down
7 changes: 6 additions & 1 deletion spec/dummy/app/views/demos/examples/_breadcrumbs.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<%= example_heading('Breadcrumbs') %>

<p class="govuk-inset-text">
To render the current level as text instead of a link you can pass either
<code>nil</code> or an empty string.
</p>

<%= render "shared/example",
title: 'Breadcrumbs',
example: <<~BREADCRUMBS
render GovukComponent::BreadcrumbsComponent.new(breadcrumbs: {
'Level one': '/level-one/',
'Level two': '/level-one/level-two/',
'Level three': '/level-one/level-two/level-three'
'Level three': nil
})
BREADCRUMBS
%>

0 comments on commit d2e96b1

Please sign in to comment.