Files
nairobi/app/views/shared/_flag_actions.html.erb
Javi Martín 6ea9383743 Allow toggling elements with the keyboard
Using `<a>` tags with no `href` means these elements cannot be activated
by keyboard users, so we're replacing them with buttons.

In the future we probably want to add more consistency so all toggle
buttons use the same code. We might also add styles depending on the
`aria-expanded` property.
2021-03-31 13:38:38 +02:00

28 lines
1.1 KiB
Plaintext

<span class="flag-content">
<% if show_flag_action?(flaggable) %>
<% if local_assigns[:divider] %>
<span class="divider">&nbsp;|&nbsp;</span>
<% end %>
<button type="button" data-toggle="flag-drop-<%= dom_id(flaggable) %>" title="<%= t("shared.flag") %>">
<span class="icon-flag flag-disable"></span>
</button>
<span class="dropdown-pane" id="flag-drop-<%= dom_id(flaggable) %>" data-dropdown data-auto-focus="true">
<%= link_to t("shared.flag"), polymorphic_path(flaggable, action: :flag), method: :put, remote: true %>
</span>
<% end %>
<% if show_unflag_action?(flaggable) %>
<% if local_assigns[:divider] %>
<span class="divider">&nbsp;|&nbsp;</span>
<% end %>
<button type="button" data-toggle="unflag-drop-<%= dom_id(flaggable) %>" title="<%= t("shared.unflag") %>">
<span class="icon-flag flag-active"></span>
</button>
<span class="dropdown-pane" id="unflag-drop-<%= dom_id(flaggable) %>" data-dropdown data-auto-focus="true">
<%= link_to t("shared.unflag"), polymorphic_path(flaggable, action: :unflag), method: :put, remote: true %>
</span>
<% end %>
</span>