Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add account permissions hint for screen reader users #4902

Merged
merged 4 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Add permissions hint for visually impaired people
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 Nov 29, 2022
commit 2bac80215f49e90e889e279f95bbb0a03ac7336f
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/LineLength: Line is too long. [117/110] (https://rubystyle.guide#max-line-length)

expect(page).to have_css "li", exact_text: "Participate in debates", normalize_ws: true
end
end