Skip to content

Commit

Permalink
Add permissions hint for visually impaired people
Browse files Browse the repository at this point in the history
We were displaying an icon showing that certain actions can't be
performed. However, people who can't see the icons were hearing that
they _can_ perform certain actions while the opposite is true.

We've considered other options to solve this problem. One was to split
the list in two: actions that can be performed and actions that can't be
performed. It was tricky because in some cases we're listing that
actions that can be performed now and in other cases we're displaying
the actions that people will be able to perform once they verify their
account.

Another option was to include the word "Cannot" as a prefix instead of
"Additional verification needed". We haven't done so because, while in
English we say "cannot do this thing", in other languages they say
"this thing cannot do".

So we've gone with a solution where people hearing what's on the screen
know what's going on and we don't have to make big changes in the code.
  • Loading branch information
javierm committed Aug 11, 2022
1 parent 2df7aa4 commit 49b319e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/components/account/permissions_list_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<ul class="permissions-list">
<% permissions.each do |text, allowed| %>
<li class="<%= allowed_class(allowed) %>">
<% unless allowed %>
<span class="show-for-sr"><%= t("verification.verification_needed") %></span>
<% end %>
<%= text %>
</li>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/en/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ en:
user_permission_proposal: Create new proposals
user_permission_support_proposal: Support proposals
user_permission_votes: Vote for budget projects
verification_needed: Additional verification needed
verified_user:
form:
submit_button: Send code
Expand Down
1 change: 1 addition & 0 deletions config/locales/es/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ es:
user_permission_proposal: Crear nuevas propuestas
user_permission_support_proposal: Apoyar propuestas
user_permission_votes: Votar proyectos en los presupuestos participativos
verification_needed: Verificación adicional necesaria
verified_user:
form:
submit_button: Enviar código
Expand Down
7 changes: 7 additions & 0 deletions spec/components/account/permissions_list_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@
expect(page).to have_css "li.permission-allowed", text: "Participate in debates"
expect(page).to have_css "li.permission-denied", text: "Support proposals"
end

it "adds a hint when an action cannot be performed" do
render_inline Account::PermissionsListComponent.new(User.new)

expect(page).to have_css "li", exact_text: "Additional verification needed Support proposals", normalize_ws: true
expect(page).to have_css "li", exact_text: "Participate in debates", normalize_ws: true
end
end

0 comments on commit 49b319e

Please sign in to comment.