diff --git a/app/components/shared/avatar_component.rb b/app/components/shared/avatar_component.rb index 40ce21f9b..a8f310069 100644 --- a/app/components/shared/avatar_component.rb +++ b/app/components/shared/avatar_component.rb @@ -49,7 +49,7 @@ class Shared::AvatarComponent < ApplicationComponent width: size, height: size, role: "img", - "aria-label": "", + "aria-hidden": true, style: "background-color: #{background_color}", class: "initialjs-avatar #{options[:class]}".strip } diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb index f0687630a..5fca4acd6 100644 --- a/app/views/budgets/groups/show.html.erb +++ b/app/views/budgets/groups/show.html.erb @@ -23,6 +23,6 @@
- <%= image_tag(image_path_for("map.jpg")) %> + <%= image_tag(image_path_for("map.jpg"), alt: t("shared.tags_cloud.districts_list")) %>
diff --git a/app/views/dashboard/mailer/forward.html.erb b/app/views/dashboard/mailer/forward.html.erb index 553ce766a..6d16ab1f9 100644 --- a/app/views/dashboard/mailer/forward.html.erb +++ b/app/views/dashboard/mailer/forward.html.erb @@ -5,9 +5,9 @@ - <%= image_tag "quote_before_white.png", style: "max-width: 40px; vertical-align: top;" %> + <%= image_tag "quote_before_white.png", alt: "", style: "max-width: 40px; vertical-align: top;" %>

<%= @proposal.title %>

- <%= image_tag "quote_after_white.png", style: "max-width: 40px; vertical-align: top;" %> + <%= image_tag "quote_after_white.png", alt: "", style: "max-width: 40px; vertical-align: top;" %>

<%= sanitize(t("dashboard.mailer.forward.subtitle")) %>

@@ -15,9 +15,13 @@ <% if @proposal.image.present? %> - <%= image_tag @proposal.image.variant(:large), style: "width: 100%; box-shadow: -16px 61px 49px -19px rgba(0,0,0,0.1);" %> + <%= image_tag @proposal.image.variant(:large), + alt: @proposal.image.title.unicode_normalize, + style: "width: 100%; box-shadow: -16px 61px 49px -19px rgba(0,0,0,0.1);" %> <% else %> - <%= image_tag "default_mailing.jpg", style: "width: 100%; box-shadow: -16px 61px 49px -19px rgba(0,0,0,0.1);" %> + <%= image_tag "default_mailing.jpg", + alt: "", + style: "width: 100%; box-shadow: -16px 61px 49px -19px rgba(0,0,0,0.1);" %> <% end %>

<%= t("dashboard.mailer.forward.hi") %>

diff --git a/app/views/dashboard/mailing/index.html.erb b/app/views/dashboard/mailing/index.html.erb index 713f85935..1f6a5a2ea 100644 --- a/app/views/dashboard/mailing/index.html.erb +++ b/app/views/dashboard/mailing/index.html.erb @@ -2,14 +2,18 @@
- <%= image_tag "quote_before_white.png" %> + <%= image_tag "quote_before_white.png", alt: "" %>

<%= proposal.title %>

- <%= image_tag "quote_after_white.png" %> + <%= image_tag "quote_after_white.png", alt: "" %>

<%= sanitize(t("dashboard.mailer.forward.subtitle")) %>

- <%= image_tag(proposal.image&.variant(:large).presence || "default_mailing.jpg") %> + <% if proposal.image.present? %> + <%= image_tag(proposal.image.variant(:large), alt: proposal.image.title.unicode_normalize) %> + <% else %> + <%= image_tag("default_mailing.jpg", alt: "") %> + <% end %>
diff --git a/app/views/dashboard/poster/index.html.erb b/app/views/dashboard/poster/index.html.erb index bbd988356..e8e7112cd 100644 --- a/app/views/dashboard/poster/index.html.erb +++ b/app/views/dashboard/poster/index.html.erb @@ -6,7 +6,7 @@

<%= t("dashboard.poster.index.poster_title") %>
- <%= image_tag("finger.png") %> + <%= image_tag("finger.png", alt: "") %> <%= t("dashboard.poster.index.poster_subtitle") %>

@@ -25,9 +25,9 @@

<%= t("dashboard.poster.index.support") %>

- <%= image_tag "quote_before_blue.png" %> + <%= image_tag "quote_before_blue.png", alt: "" %>

<%= proposal.title %>

- <%= image_tag "quote_after_blue.png" %> + <%= image_tag "quote_after_blue.png", alt: "" %> diff --git a/app/views/dashboard/poster/index.pdf.erb b/app/views/dashboard/poster/index.pdf.erb index 7c4eaebe1..9a8b0e383 100644 --- a/app/views/dashboard/poster/index.pdf.erb +++ b/app/views/dashboard/poster/index.pdf.erb @@ -11,7 +11,7 @@

<%= t("dashboard.poster.index.poster_title") %>
- <%= wicked_pdf_image_tag("finger.png") %> + <%= wicked_pdf_image_tag("finger.png", alt: "") %> <%= t("dashboard.poster.index.poster_subtitle") %>

@@ -30,9 +30,9 @@

<%= t("dashboard.poster.index.support") %>

- <%= wicked_pdf_image_tag "quote_before_blue.png" %> + <%= wicked_pdf_image_tag "quote_before_blue.png", alt: "" %>

<%= proposal.title %>

- <%= wicked_pdf_image_tag "quote_after_blue.png" %> + <%= wicked_pdf_image_tag "quote_after_blue.png", alt: "" %> diff --git a/app/views/proposals/map.html.erb b/app/views/proposals/map.html.erb index dde4a610f..261cd49ef 100644 --- a/app/views/proposals/map.html.erb +++ b/app/views/proposals/map.html.erb @@ -13,7 +13,7 @@
- <%= image_tag(image_path_for("map.jpg"), usemap: "#map") %> + <%= image_tag(image_path_for("map.jpg"), alt: t("shared.tags_cloud.districts_list"), usemap: "#map") %>
diff --git a/spec/components/shared/avatar_component_spec.rb b/spec/components/shared/avatar_component_spec.rb index cc1d7b1e1..66a82c5c7 100644 --- a/spec/components/shared/avatar_component_spec.rb +++ b/spec/components/shared/avatar_component_spec.rb @@ -8,7 +8,7 @@ describe Shared::AvatarComponent do render_inline component expect(page).to have_css "svg", count: 1 - expect(page).to have_css "svg[role='img'][aria-label='']" + expect(page).to have_css "svg[role='img'][aria-hidden='true']" end it "shows the initial letter of the name" do diff --git a/spec/system/admin/site_customization/images_spec.rb b/spec/system/admin/site_customization/images_spec.rb index 3ed98ffa6..10ceb3149 100644 --- a/spec/system/admin/site_customization/images_spec.rb +++ b/spec/system/admin/site_customization/images_spec.rb @@ -45,19 +45,19 @@ describe "Admin custom images", :admin do visit proposals_path within("#map") do - expect(page).to have_css("img[src*='custom_map.jpg']") + expect(page).to have_css("img[src*='custom_map.jpg'][alt='Districts list']") end visit map_proposals_path within(".show-for-medium") do - expect(page).to have_css("img[src*='custom_map.jpg']") + expect(page).to have_css("img[src*='custom_map.jpg'][alt='Districts list']") end visit budget_group_path(budget, group) within(".show-for-medium") do - expect(page).to have_css("img[src*='custom_map.jpg']") + expect(page).to have_css("img[src*='custom_map.jpg'][alt='Districts list']") end end diff --git a/spec/system/xss_spec.rb b/spec/system/xss_spec.rb index 32b1cb03c..0046e2bdd 100644 --- a/spec/system/xss_spec.rb +++ b/spec/system/xss_spec.rb @@ -170,7 +170,7 @@ describe "Cross-Site Scripting protection" do end scenario "legislation version body filters script tags but not header IDs nor tags like images" do - markdown = "# Title 1\nlink" + markdown = "# Title 1\nlinktext" version = create(:legislation_draft_version, :published, body: "#{markdown}#{attack_code}") visit legislation_process_draft_version_path(version.process, version) @@ -178,6 +178,6 @@ describe "Cross-Site Scripting protection" do expect(page.text).not_to be_empty expect(page).to have_css "h1#title-1", text: "Title 1" expect(page).to have_link "link", href: "https://domain.com/url" - expect(page).to have_css('img[src="/image.png"') + expect(page).to have_css('img[src="/image.png"]') end end