Skip to content

Commit

Permalink
Merge pull request #3319 from projectblacklight/jcoyne-patch-2
Browse files Browse the repository at this point in the history
Improve semantic markup of breadcrumbs.
  • Loading branch information
corylown authored Dec 9, 2024
2 parents 5273dff + cfa544d commit 962bb68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
32 changes: 13 additions & 19 deletions app/components/spotlight/breadcrumbs_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
<div class="container breadcrumbs-container" role="navigation" aria-label="<%= t('spotlight.breadcrumb.label') %>">
<div class="row">
<div class="col-md-12">
<nav>
<ul class="breadcrumb list-unstyled d-flex">
<% breadcrumbs.each do |crumb| %>
<li class="breadcrumb-item <%= crumb == breadcrumbs.last ? 'active' : '' %>">
<% if crumb.link? && crumb != breadcrumbs.last %>
<%= link_to crumb.name, path(crumb.path) %>
<% else %>
<%= crumb.name %>
<% end %>
</li>
<% end %>
</ul>
</nav>
</div>
</div>
</div>
<nav class="container breadcrumbs-container" aria-label="<%= t('spotlight.breadcrumb.label') %>">
<ol class="breadcrumb">
<% breadcrumbs.each do |crumb| %>
<li class="breadcrumb-item <%= crumb == breadcrumbs.last ? 'active' : '' %>">
<% if crumb.link? && crumb != breadcrumbs.last %>
<%= link_to crumb.name, path(crumb.path) %>
<% else %>
<%= crumb.name %>
<% end %>
</li>
<% end %>
</ol>
</nav>
4 changes: 2 additions & 2 deletions spec/features/browse_category_navigation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

describe 'Browse pages' do
RSpec.describe 'Browse pages' do
let(:exhibit) { FactoryBot.create(:exhibit) }
let!(:search) { FactoryBot.create(:search, title: 'Some Saved Search', exhibit:, published: true) }
let!(:search_2) { FactoryBot.create(:search, title: 'Some Other Saved Search', exhibit:, published: true) }
Expand Down Expand Up @@ -37,7 +37,7 @@
expect(page).to have_css 'li.nav-item a.nav-link.active', text: group.title
end
click_link 'Some Saved Search'
expect(page).to have_css 'ul.breadcrumb li.breadcrumb-item', count: 4
expect(page).to have_css 'ol.breadcrumb li.breadcrumb-item', count: 4
expect(page).to have_css 'li.breadcrumb-item', text: 'Awesome group'
end
end
Expand Down

0 comments on commit 962bb68

Please sign in to comment.