-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional accessible text to linked faceted searches
This updates the LinkToFacet rendering step to add an additional visually hidden element when creating a link to a faceted search that indicates the facet that will be used in the search. This helps give additional context to screen reader users when link_to_facet is used, especially when the page may include links that go to searches for the same value in different fields. Fixes #3427
- Loading branch information
1 parent
344df8a
commit 79d0a73
Showing
14 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
spec/presenters/blacklight/rendering/link_to_facet_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe Blacklight::Rendering::LinkToFacet do | ||
include Capybara::RSpecMatchers | ||
include Rails.application.routes.url_helpers | ||
|
||
let(:field_config) { Blacklight::Configuration::Field.new(link_to_facet: true, key: 'key', label: 'label') } | ||
let(:document) { instance_double(SolrDocument) } | ||
let(:query_params) { { controller: 'catalog', action: 'show' } } | ||
let(:config) { Blacklight::Configuration.new } | ||
let(:search_state) { Blacklight::SearchState.new(query_params, config) } | ||
let(:context) { double(search_state: search_state) } | ||
let(:pipeline) { Blacklight::Rendering::Pipeline.new(values, field_config, document, context, [described_class], {}) } | ||
|
||
before do | ||
allow(context).to receive_messages( | ||
search_action_path: double, | ||
link_to: double, | ||
tag: double(span: nil), | ||
t: 'label search' | ||
) | ||
end | ||
|
||
describe '#render' do | ||
let(:values) { %w[a] } | ||
|
||
before { pipeline.render } | ||
|
||
it 'renders the value' do | ||
expect(context.tag).to have_received(:span).with('a') | ||
end | ||
|
||
it 'renders the accessible description' do | ||
expect(context.tag).to have_received(:span).with('label search', class: 'visually-hidden') | ||
end | ||
end | ||
end |