diff --git a/app/components/blacklight/response/view_type_button_component.html.erb b/app/components/blacklight/response/view_type_button_component.html.erb index b5ef58d0ff..8696d8de2c 100644 --- a/app/components/blacklight/response/view_type_button_component.html.erb +++ b/app/components/blacklight/response/view_type_button_component.html.erb @@ -1,4 +1,4 @@ -<%= link_to url, title: label, class: "#{Array(@classes).join(' ')} view-type-#{ @key.to_s.parameterize } #{"active" if selected?}" do %> +<%= link_to url, title: label, aria: aria_attributes, class: "#{Array(@classes).join(' ')} view-type-#{ @key.to_s.parameterize } #{"active" if selected?}" do %> <%= icon %> <%= label %> <% end %> diff --git a/app/components/blacklight/response/view_type_button_component.rb b/app/components/blacklight/response/view_type_button_component.rb index 3ec0474537..5bd2fde2ac 100644 --- a/app/components/blacklight/response/view_type_button_component.rb +++ b/app/components/blacklight/response/view_type_button_component.rb @@ -25,6 +25,12 @@ def label @view.display_label end + def aria_attributes + return unless selected? + + { current: true } + end + def url helpers.url_for(@search_state.to_h.merge(view: @key)) end