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

Conversation

javierm
Copy link
Member

@javierm javierm commented Aug 11, 2022

Objectives

  • Make sure people who can't see the "X" icon are notified that they cannot perform an action

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)

@javierm javierm force-pushed the permission_list_accessibility branch 2 times, most recently from 608831b to 49b319e Compare August 11, 2022 21:01
@javierm javierm force-pushed the permission_list_accessibility branch from 49b319e to b859cb8 Compare September 9, 2022 01:54
@javierm javierm force-pushed the permission_list_accessibility branch from b859cb8 to 830501c Compare October 28, 2022 00:11
@taitus taitus added the 1.6.0 label Oct 28, 2022
@taitus taitus self-assigned this Nov 29, 2022
We were using similar code in four different places; six, if we count
the welcome pages seeds. Reducing duplication in the pages seeds is a
bit tricky because administrators are supposed to edit their content and
might remove the HTML class we use to define styles. However, we can
share the code everywhere else.

Note that there's a bug in the application since we show that level 2
users cannot vote for budget projects but we give them permission to do
so in the abilities model. We're keeping the same behavior after this
refactoring but we might change it in the future.
This way we simplify the ERB code.

Due to the bug mentioned in the previous commit, we're keeping the
original code instead of using `can?` to check permissions.
As mentioned in commit 925f04e, icon classes make screen readers
announce strange symbols and aren't properly displayed for people who
have changed their preferred font family.
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.
@javierm javierm force-pushed the permission_list_accessibility branch from 830501c to 2bac802 Compare November 29, 2022 17:48
Consul Democracy automation moved this from Reviewing to Testing Dec 1, 2022
@javierm javierm merged commit f4bd8e9 into master Dec 1, 2022
Consul Democracy automation moved this from Testing to Release 2.0.0 Dec 1, 2022
@javierm javierm deleted the permission_list_accessibility branch December 1, 2022 13:02
@javierm javierm removed the 2.0 label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants