Skip to content

Commit

Permalink
AO3-6553 Turn homepage media list into navigation
Browse files Browse the repository at this point in the history
Semantically, the list of media (plus All Fandoms) is a navigation
element, not a menu.

The preferred element to use would be `nav`, but we don't use this
anywhere else (yet), so for consistency I'm adding a `div` with the role
navigation.

(Per https://www.w3.org/TR/html-aria/#docconformance, `ul`s are not
allowed to have the role `navigation`.)

I've also done the two "easy" translation strings.
  • Loading branch information
neuroalien committed Jul 17, 2023
1 parent d997475 commit 365f1ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/views/menu/_menu_fandoms.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<ul class="menu" role="menu">
<li><%= link_to ts('All Fandoms', key: 'header.fandom'), media_path %></li>
<% cache "menu-fandoms-version4", skip_digest: true do %>
<% Media.for_menu.each do |medium| %>
<% unless medium.id.nil? %>
<li id="medium_<%= medium.id %>"><%= link_to ts("#{medium.name}", key: 'header.fandom'), medium_fandoms_path(medium) %></li>
<div role="navigation" aria-label="<%= t(".media") %>">
<ul class="menu">
<li><%= link_to t(".all_fandoms"), media_path %></li>
<% cache "menu-fandoms-version4", skip_digest: true do %>
<% Media.for_menu.each do |medium| %>
<% unless medium.id.nil? %>
<li id="medium_<%= medium.id %>"><%= link_to ts("#{medium.name}", key: 'header.fandom'), medium_fandoms_path(medium) %></li>
<% end %>
<% end %>
<% end %>
<% end %>
</ul>
</ul>
</div>
4 changes: 4 additions & 0 deletions config/locales/views/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ en:
faux_heading: 'Important message:'
point1: You are using a proxy site that is not part of the Archive of Our Own.
point2: The entity that set up the proxy site can see what you submit, including your IP address. If you log in through the proxy site, it can see your password.
menu:
menu_fandoms:
all_fandoms: All Fandoms
media: Media
muted:
mute: Mute
muted_items_notice_html: You have muted some users on the Archive. Some items may not be shown, and any counts may be inaccurate. You can mute or unmute users on %{muted_users_link}.
Expand Down

0 comments on commit 365f1ea

Please sign in to comment.