Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve semantic markup of breadcrumbs. #3319

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading