Skip to content

Commit

Permalink
add aria-current for view-type buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
dnoneill committed Dec 16, 2024
1 parent 03ce099 commit fcc9306
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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 %>
<span class="caption"><%= label %></span>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fcc9306

Please sign in to comment.