From d3c65fc99da618628ae7a10c4ff265a16303a13d Mon Sep 17 00:00:00 2001 From: Jacob Herrington Date: Tue, 18 Aug 2020 15:58:45 -0500 Subject: [PATCH] [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 --- app/views/admin/articles/index.html.erb | 6 +-- app/views/admin/badges/award.html.erb | 38 ++++++++++--------- app/views/admin/badges/edit.html.erb | 6 +-- app/views/admin/badges/index.html.erb | 36 +++++++++--------- app/views/admin/badges/new.html.erb | 4 +- app/views/admin/broadcasts/_form.html.erb | 8 ++-- app/views/admin/broadcasts/edit.html.erb | 4 +- app/views/admin/broadcasts/index.html.erb | 45 ++++++++++++----------- app/views/admin/broadcasts/new.html.erb | 4 +- app/views/admin/broadcasts/show.html.erb | 4 +- app/views/layouts/admin.html.erb | 20 +++++----- 11 files changed, 90 insertions(+), 85 deletions(-) diff --git a/app/views/admin/articles/index.html.erb b/app/views/admin/articles/index.html.erb index 4729134d8..a46ecb2f4 100644 --- a/app/views/admin/articles/index.html.erb +++ b/app/views/admin/articles/index.html.erb @@ -8,7 +8,7 @@ <% end %> -
+
+
<%= render "image_upload_script" %> diff --git a/app/views/admin/badges/award.html.erb b/app/views/admin/badges/award.html.erb index f23b36e56..c8341920c 100644 --- a/app/views/admin/badges/award.html.erb +++ b/app/views/admin/badges/award.html.erb @@ -1,19 +1,21 @@ -

Award Badges

-
Warning: Usernames are case-sensitive and must be all lowercase! This task will fail silently when supplied with incorrect +
+

Award Badges

+
Warning: Usernames are case-sensitive and must be all lowercase! This task will fail silently when supplied with incorrect usernames.
-<%= form_with(url: admin_badge_achievements_award_badges_path, local: true) do |f| %> -
- <%= f.label :badge, "Badge:" %> - <%= f.select("badge", @badge.map { |badge| [badge.title, badge.slug] }, include_blank: true, class: "form-control") %> -
-
- <%= 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" %> -
-
- <%= f.label :message_markdown, "Override Default Message (Supports Markdown)" %> - <%= f.text_area :message_markdown, size: "40x10", class: "form-control" %> -
-<%= f.submit "Award Badges", class: "btn btn-primary mb-4" %> -<% end %> -
+ <%= form_with(url: admin_badge_achievements_award_badges_path, local: true) do |f| %> +
+ <%= f.label :badge, "Badge:" %> + <%= f.select("badge", @badge.map { |badge| [badge.title, badge.slug] }, include_blank: true, class: "form-control") %> +
+
+ <%= 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" %> +
+
+ <%= f.label :message_markdown, "Override Default Message (Supports Markdown)" %> + <%= f.text_area :message_markdown, size: "40x10", class: "form-control" %> +
+ <%= f.submit "Award Badges", class: "btn btn-primary mb-4" %> + <% end %> +
+ diff --git a/app/views/admin/badges/edit.html.erb b/app/views/admin/badges/edit.html.erb index 2f5aa851d..1c76abc43 100644 --- a/app/views/admin/badges/edit.html.erb +++ b/app/views/admin/badges/edit.html.erb @@ -1,6 +1,6 @@ -
+
-

<%= "Edit Badge #{@badge.id}" %>

+

<%= "Edit Badge #{@badge.id}" %>

<%= form_for [:admin, @badge], method: :patch do |form| %>
<%= form.label :title %> @@ -31,4 +31,4 @@ <% end %> <%= link_to "Back to All Badges", admin_badges_path, class: "btn btn-primary float-left" %>
-
+
diff --git a/app/views/admin/badges/index.html.erb b/app/views/admin/badges/index.html.erb index 4306bad0a..863929422 100644 --- a/app/views/admin/badges/index.html.erb +++ b/app/views/admin/badges/index.html.erb @@ -1,28 +1,28 @@ -
+
+
<%= 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" %>
- - - - - - - - - - <% @badges.each do |badge| %> +
TitleSlugBadge Image
+ - -
+
+ + + + + + <% @badges.each do |badge| %> + + - - - <% end %> - -
<%= link_to badge.title, edit_admin_badge_path(badge.id) %>TitleSlugBadge Image
<%= link_to badge.title, edit_admin_badge_path(badge.id) %> <%= badge.slug %> badge image
+ + <% end %> + + +
diff --git a/app/views/admin/badges/new.html.erb b/app/views/admin/badges/new.html.erb index c929802f1..3c3dec85c 100644 --- a/app/views/admin/badges/new.html.erb +++ b/app/views/admin/badges/new.html.erb @@ -1,4 +1,4 @@ -
+

Create a Badge:

<%= form_for [:admin, @badge], method: :post do |form| %> @@ -27,4 +27,4 @@ <%= submit_tag "Create Badge", class: "btn btn-primary float-right" %> <% end %>
-
+ diff --git a/app/views/admin/broadcasts/_form.html.erb b/app/views/admin/broadcasts/_form.html.erb index 98888bd3d..5a4113bcb 100644 --- a/app/views/admin/broadcasts/_form.html.erb +++ b/app/views/admin/broadcasts/_form.html.erb @@ -1,4 +1,4 @@ -

Title - this for our reference only:

+<%= label_tag :title, "Title:" %> <%= text_field_tag :title, @broadcast.title %>
@@ -6,12 +6,12 @@ <%= text_area_tag :processed_html, @broadcast.processed_html, size: "100x10", class: "form-control" %>
- <%= 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) %>
<%= 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 %>
<%= label_tag :active, "Active:" %> diff --git a/app/views/admin/broadcasts/edit.html.erb b/app/views/admin/broadcasts/edit.html.erb index b5fd9bb99..183dd86e2 100644 --- a/app/views/admin/broadcasts/edit.html.erb +++ b/app/views/admin/broadcasts/edit.html.erb @@ -1,4 +1,4 @@ -
+

Edit broadcast:

<%= form_for([:admin, @broadcast], method: :patch) do %> @@ -6,4 +6,4 @@ <%= submit_tag "Update Broadcast", class: "btn btn-primary float-right" %> <% end %>
-
+ diff --git a/app/views/admin/broadcasts/index.html.erb b/app/views/admin/broadcasts/index.html.erb index a7a67149d..c81bc7f71 100644 --- a/app/views/admin/broadcasts/index.html.erb +++ b/app/views/admin/broadcasts/index.html.erb @@ -1,4 +1,4 @@ -
+
-
+ -
Note: You must ensure that your Broadcast is active in order for it to be sent to users!
- - - - - - - - - - <% @broadcasts.each do |broadcast| %> +
+
+ Note: You must ensure that your Broadcast is active in order for it to be sent to users! +
+
TitleStatus
+ - - + + + + + <% @broadcasts.each do |broadcast| %> + + + - - <% end %> - -
<%= link_to broadcast.title, admin_broadcast_path(broadcast.id) %> -
+
TitleStatus
<%= link_to broadcast.title, admin_broadcast_path(broadcast.id) %>
"> <%= broadcast.active? ? "Active" : "Inactive" %>
- -
+ + + <% end %> + + + <%= csrf_meta_tags %> diff --git a/app/views/admin/broadcasts/new.html.erb b/app/views/admin/broadcasts/new.html.erb index b1073e97e..860a51ef2 100644 --- a/app/views/admin/broadcasts/new.html.erb +++ b/app/views/admin/broadcasts/new.html.erb @@ -1,4 +1,4 @@ -
+

Make a new broadcast:

<%= form_for([:admin, @broadcast], method: :post) do %> @@ -6,4 +6,4 @@ <%= submit_tag "Create Broadcast", class: "btn btn-primary float-right" %> <% end %>
-
+ diff --git a/app/views/admin/broadcasts/show.html.erb b/app/views/admin/broadcasts/show.html.erb index 4ee1f9fda..e39c03403 100644 --- a/app/views/admin/broadcasts/show.html.erb +++ b/app/views/admin/broadcasts/show.html.erb @@ -1,4 +1,4 @@ - + <%= csrf_meta_tags %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index d25af16d1..d1a0bab7e 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -34,15 +34,17 @@
- <% flash.each do |type, message| %> -
"> - - <%= message %> -
- <% end %> -

<%= controller_name.titleize %>

+
+ <% flash.each do |type, message| %> +
"> + + <%= message %> +
+ <% end %> +

<%= controller_name.titleize %>

+
<%= yield %>