[deploy] Apply fixes for axe issues in admin interfaces (#9851)

* Apply fixes for axe issues

This commit contains a handful of fixes for possible accessibility
issues flagged by axe.

I'm currently working through the rest of our admin interface and will
break those changes into seperate commits due to the need for cleanup in
some of the more complicated interfaces.

* Fixup: typo in aria-label

* Escape quotes
This commit is contained in:
Jacob Herrington 2020-08-18 15:58:45 -05:00 committed by GitHub
parent b003f45de8
commit d3c65fc99d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 90 additions and 85 deletions

View file

@ -8,7 +8,7 @@
</div>
<% end %>
<div class="row">
<main class="row">
<div class="col-12">
<ul class="nav nav-tabs nav-fill">
<li class="nav-item">
@ -55,7 +55,7 @@
<div class="card-body">
<h4>Score: <%= buffer_update.article.score %></h4>
<div class="blockquote">
<%= HTML_Truncator.truncate(buffer_update.article.processed_html, 50, ellipsis: '<a class="comment-read-more" href="' + buffer_update.article.path + '">... Read Entire Post</a>').html_safe %>
<%= HTML_Truncator.truncate(buffer_update.article.processed_html, 50, ellipsis: "<a class=\"comment-read-more\" href=\"#{buffer_update.article.path}\">... Read Entire Post</a>").html_safe %>
</div>
<hr />
@ -104,6 +104,6 @@
<%= paginate @articles %>
</div>
</div>
</main>
<%= render "image_upload_script" %>

View file

@ -1,19 +1,21 @@
<h3>Award Badges</h3>
<div class="alert alert-warning"><strong>Warning: Usernames are case-sensitive and must be all lowercase! This task will fail silently when supplied with incorrect
<main>
<h2>Award Badges</h2>
<div class="alert alert-warning"><strong>Warning: Usernames are case-sensitive and must be all lowercase! This task will fail silently when supplied with incorrect
usernames.<strong></div>
<%= form_with(url: admin_badge_achievements_award_badges_path, local: true) do |f| %>
<div class="form-group">
<%= f.label :badge, "Badge:" %>
<%= f.select("badge", @badge.map { |badge| [badge.title, badge.slug] }, include_blank: true, class: "form-control") %>
</div>
<div class="form-group">
<%= f.label :usernames, "Usernames (Comma Delimited, All Lowercase, No @ Symbol Required In Front Of Usernames)*" %>
<%= f.text_area :usernames, placeholder: "username1, username2, username3", required: true, size: "40x10", class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :message_markdown, "Override Default Message (Supports Markdown)" %>
<%= f.text_area :message_markdown, size: "40x10", class: "form-control" %>
</div>
<%= f.submit "Award Badges", class: "btn btn-primary mb-4" %>
<% end %>
</div>
<%= form_with(url: admin_badge_achievements_award_badges_path, local: true) do |f| %>
<div class="form-group">
<%= f.label :badge, "Badge:" %>
<%= f.select("badge", @badge.map { |badge| [badge.title, badge.slug] }, include_blank: true, class: "form-control") %>
</div>
<div class="form-group">
<%= f.label :usernames, "Usernames (Comma Delimited, All Lowercase, No @ Symbol Required In Front Of Usernames)*" %>
<%= f.text_area :usernames, placeholder: "username1, username2, username3", required: true, size: "40x10", class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :message_markdown, "Override Default Message (Supports Markdown)" %>
<%= f.text_area :message_markdown, size: "40x10", class: "form-control" %>
</div>
<%= f.submit "Award Badges", class: "btn btn-primary mb-4" %>
<% end %>
</div>
</main>

View file

@ -1,6 +1,6 @@
<div class="row">
<main class="row">
<div class="col-12">
<h3><%= "Edit Badge #{@badge.id}" %></h3>
<h2><%= "Edit Badge #{@badge.id}" %></h2>
<%= form_for [:admin, @badge], method: :patch do |form| %>
<div class="form-group">
<%= form.label :title %>
@ -31,4 +31,4 @@
<% end %>
<%= link_to "Back to All Badges", admin_badges_path, class: "btn btn-primary float-left" %>
</div>
</div>
</main>

View file

@ -1,28 +1,28 @@
<div class="col">
<main>
<div class="col">
<div class="row justify-content-end">
<%= link_to "Create Badge", new_admin_badge_path, class: "btn btn-primary" %>
<%= link_to "Award Badge", admin_badge_achievements_award_badges_path, style: "margin-left: 20px;", class: "btn btn-primary" %>
</div>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Slug</th>
<th scope="col">Badge Image</th>
</tr>
</thead>
<tbody>
<% @badges.each do |badge| %>
<table class="table mt-2">
<thead>
<tr>
<td><%= link_to badge.title, edit_admin_badge_path(badge.id) %></td>
<h5>
<th scope="col">Title</th>
<th scope="col">Slug</th>
<th scope="col">Badge Image</th>
</tr>
</thead>
<tbody>
<% @badges.each do |badge| %>
<tr>
<td><%= link_to badge.title, edit_admin_badge_path(badge.id) %></td>
<td class="justify-content-center"><%= badge.slug %></td>
<td class="justify-content-center">
<img class="mx-auto mt-3" width="40" height="40" src="<%= badge.badge_image %>" alt="badge image">
</td>
</h5>
</tr>
<% end %>
</tbody>
</table>
</tr>
<% end %>
</tbody>
</table>
</main>

View file

@ -1,4 +1,4 @@
<div class="row">
<main class="row">
<div class="col-12">
<h2>Create a Badge:</h2>
<%= form_for [:admin, @badge], method: :post do |form| %>
@ -27,4 +27,4 @@
<%= submit_tag "Create Badge", class: "btn btn-primary float-right" %>
<% end %>
</div>
</div>
</main>

View file

@ -1,4 +1,4 @@
<h3>Title - this for our reference only:</h3>
<%= label_tag :title, "Title:" %>
<%= text_field_tag :title, @broadcast.title %>
<hr>
<div class="form-group">
@ -6,12 +6,12 @@
<%= text_area_tag :processed_html, @broadcast.processed_html, size: "100x10", class: "form-control" %>
</div>
<div class="form-group">
<%= label_tag :type, "Type:" %>
<%= select_tag "type_of", options_for_select(%w[Welcome Announcement], selected: @broadcast.type_of) %>
<%= label_tag :type_of, "Type:" %>
<%= select_tag :type_of, options_for_select(%w[Welcome Announcement], selected: @broadcast.type_of) %>
</div>
<div class="form-group">
<%= label_tag :banner_style, "Banner Style:" %>
<%= select_tag "banner_style", options_for_select(%w[default brand success warning error], selected: @broadcast.banner_style), include_blank: true %>
<%= select_tag :banner_style, options_for_select(%w[default brand success warning error], selected: @broadcast.banner_style), include_blank: true %>
</div>
<div class="form-group">
<%= label_tag :active, "Active:" %>

View file

@ -1,4 +1,4 @@
<div class="row">
<main class="row">
<div class="col-12">
<h2>Edit broadcast:</h2>
<%= form_for([:admin, @broadcast], method: :patch) do %>
@ -6,4 +6,4 @@
<%= submit_tag "Update Broadcast", class: "btn btn-primary float-right" %>
<% end %>
</div>
</div>
</main>

View file

@ -1,4 +1,4 @@
<div class="row my-3">
<nav class="row my-3" aria-label="Broadcasts navigation">
<div class="col">
<ul class="nav nav-pills">
<li class="nav-item">
@ -17,31 +17,32 @@
<%= link_to "Make A New Broadcast", new_admin_broadcast_path, class: "btn btn-primary" %>
</div>
</div>
</div>
</nav>
<div class="alert alert-warning"><strong>Note: You must ensure that your Broadcast is active in order for it to be sent to users!</strong></div>
<table class="table">
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<% @broadcasts.each do |broadcast| %>
<main>
<div class="alert alert-warning">
<strong>Note: You must ensure that your Broadcast is active in order for it to be sent to users!</strong>
</div>
<table class="table">
<thead>
<tr>
<td><%= link_to broadcast.title, admin_broadcast_path(broadcast.id) %></td>
<td class="justify-content-center">
<h5>
<th scope="col">Title</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<% @broadcasts.each do |broadcast| %>
<tr>
<td><%= link_to broadcast.title, admin_broadcast_path(broadcast.id) %></td>
<td class="justify-content-center">
<div class="badge badge-<%= broadcast.active? ? "success" : "warning" %>">
<%= broadcast.active? ? "Active" : "Inactive" %>
</div>
</h5>
</td>
</tr>
<% end %>
</tbody>
</table>
</td>
</tr>
<% end %>
</tbody>
</table>
</main>
<%= csrf_meta_tags %>

View file

@ -1,4 +1,4 @@
<div class="row">
<main class="row">
<div class="col-12">
<h2>Make a new broadcast:</h2>
<%= form_for([:admin, @broadcast], method: :post) do %>
@ -6,4 +6,4 @@
<%= submit_tag "Create Broadcast", class: "btn btn-primary float-right" %>
<% end %>
</div>
</div>
</main>

View file

@ -1,4 +1,4 @@
<div class="row my-3">
<main class="row my-3">
<div class="col">
<div class="list-group-flush w-100">
<a class="list-group-item flex-column align-items-start">
@ -34,6 +34,6 @@
<%= link_to "Edit Broadcast", edit_admin_broadcast_path, class: "btn btn-primary float-right" %>
</div>
</div>
</div>
</main>
<%= csrf_meta_tags %>

View file

@ -34,15 +34,17 @@
</nav>
<div class="container mt-3">
<% flash.each do |type, message| %>
<div class="alert alert-<%= type == "notice" || type == "success" ? "success" : "danger" %>">
<button class="close" data-dismiss="alert">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
<%= message %>
</div>
<% end %>
<h1 class="mt-3"><%= controller_name.titleize %></h1>
<header>
<% flash.each do |type, message| %>
<div class="alert alert-<%= type == "notice" || type == "success" ? "success" : "danger" %>">
<button class="close" data-dismiss="alert" aria-label="Close">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
<%= message %>
</div>
<% end %>
<h1 class="mt-3"><%= controller_name.titleize %></h1>
</header>
<%= yield %>
</div>
</div>