diff --git a/app/components/shared/in_favor_against_component.html.erb b/app/components/shared/in_favor_against_component.html.erb index a085c1d46..fcb4564f0 100644 --- a/app/components/shared/in_favor_against_component.html.erb +++ b/app/components/shared/in_favor_against_component.html.erb @@ -2,7 +2,11 @@
<% if current_user %> <%= link_to polymorphic_path(votable, action: :vote, value: "yes"), - class: "like #{voted_classes[:in_favor]}", title: t("votes.agree"), method: "post", remote: true do %> + class: "like #{voted_classes[:in_favor]}", + title: t("votes.agree"), + "aria-label": agree_aria_label, + method: "post", + remote: true do %> <%= t("votes.agree") %> @@ -22,7 +26,12 @@
<% if current_user %> - <%= link_to polymorphic_path(votable, action: :vote, value: "no"), class: "unlike #{voted_classes[:against]}", title: t("votes.disagree"), method: "post", remote: true do %> + <%= link_to polymorphic_path(votable, action: :vote, value: "no"), + class: "unlike #{voted_classes[:against]}", + title: t("votes.disagree"), + "aria-label": disagree_aria_label, + method: "post", + remote: true do %> <%= t("votes.disagree") %> diff --git a/app/components/shared/in_favor_against_component.rb b/app/components/shared/in_favor_against_component.rb index 4d944d14c..8806057c6 100644 --- a/app/components/shared/in_favor_against_component.rb +++ b/app/components/shared/in_favor_against_component.rb @@ -22,4 +22,12 @@ class Shared::InFavorAgainstComponent < ApplicationComponent { in_favor: "", against: "" } end end + + def agree_aria_label + t("votes.agree_label", title: votable.title) + end + + def disagree_aria_label + t("votes.disagree_label", title: votable.title) + end end diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 260bd56bd..743800aea 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -847,9 +847,11 @@ en: retired_help_text: Dashboard not available for retired proposals votes: agree: I agree + agree_label: "I agree with %{title}" anonymous: Too many anonymous votes to admit vote %{verify_account}. comment_unauthenticated: You must %{signin} or %{signup} to vote. disagree: I disagree + disagree_label: "I don't agree with %{title}" organizations: Organizations are not permitted to vote supports: Supports verified_only: Only verified users can vote on proposals; %{verify_account}. diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 661f1da17..1511b9826 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -847,9 +847,11 @@ es: retired_help_text: Dashboard no disponible para propuestas retiradas votes: agree: Estoy de acuerdo + agree_label: "Estoy de acuerdo con %{title}" anonymous: Demasiados votos anónimos, para poder votar %{verify_account}. comment_unauthenticated: Necesitas %{signin} o %{signup} para poder votar. disagree: No estoy de acuerdo + disagree_label: "No estoy de acuerdo con %{title}" organizations: Las organizaciones no pueden votar. supports: Apoyos verified_only: Las propuestas sólo pueden ser votadas por usuarios verificados, %{verify_account}. diff --git a/spec/components/debates/votes_component_spec.rb b/spec/components/debates/votes_component_spec.rb index 25979df62..af9e1f5f5 100644 --- a/spec/components/debates/votes_component_spec.rb +++ b/spec/components/debates/votes_component_spec.rb @@ -22,7 +22,9 @@ describe Debates::VotesComponent do expect(page).to have_link count: 2 expect(page).to have_link "I agree", title: "I agree" + expect(page).to have_link "I agree with What about the 2030 agenda?" expect(page).to have_link "I disagree", title: "I disagree" + expect(page).to have_link "I don't agree with What about the 2030 agenda?" expect(page).not_to have_content "You must sign in or sign up to continue." end end diff --git a/spec/components/legislation/proposals/votes_component_spec.rb b/spec/components/legislation/proposals/votes_component_spec.rb index e83f2266e..26f7c0638 100644 --- a/spec/components/legislation/proposals/votes_component_spec.rb +++ b/spec/components/legislation/proposals/votes_component_spec.rb @@ -35,7 +35,9 @@ describe Legislation::Proposals::VotesComponent do expect(page).to have_link count: 2 expect(page).to have_link "I agree", title: "I agree" + expect(page).to have_link "I agree with Require wearing masks at home" expect(page).to have_link "I disagree", title: "I disagree" + expect(page).to have_link "I don't agree with Require wearing masks at home" expect(page).not_to have_content "You must sign in or sign up to continue." end end