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

[PM-2432] Desktop: Modify switch account dropdown/dialog for accessibility #5529

Merged
merged 7 commits into from
Oct 31, 2023

Conversation

patrickhlauke
Copy link
Contributor

@patrickhlauke patrickhlauke commented May 28, 2023

Type of change

- [x] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Correct confusing/incomplete switch account menu button and the account dropdown/dialog to actually make sense when using a screen reader. Closes #5525

When already in an account (the menu button shows the current email address), the button is now announced as "[current email address] (Switch account)". The individual account buttons in the dropdown/modal are now announced as "Switch account: [email address] (Locked)".

Code changes

  • apps/desktop/src/app/layout/account-switcher.component.html: remove aria-controls and aria-expanded, as they make no sense for a button that opens a dialog (rather than a disclosure widget). for same reason, change aria-haspopup="menu" to aria-haspopup="dialog" (as it opens a dialog, not a menu). add "(Switch account)" to the accessible name of the button (when already using an account). corrects the accessible name for the buttons to switch to other accounts: simply uses the visible text (with a few minor sr-only additions for readability), instead of the "Logged in as ..." (which currently also doesn't convey locked/unlocked status)

Screenshots

Video of Bitwarden on Windows, with NVDA running. Note the voice output, compared to the video in #5525

bitwarden-issue5525-fix.mp4

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
  • Ensure that all UI additions follow WCAG AA requirements

- if it opens a dialog, it should advertise this with `aria-haspopup="dialog"`, not `aria-haspopup="menu"`
- if it opens a dialog, the `aria-expanded` is pointless (as the user will never get back out into the underlying page to check if it's expanded or collapsed, since it's for a dialog not a disclosure widget or menu)
as it's a dialog that opens, not a disclosure, this is irrelevant
just use existing single button, but add visually hidden extra "Switch account" to accName
@patrickhlauke patrickhlauke requested review from a team as code owners May 28, 2023 19:42
@patrickhlauke patrickhlauke force-pushed the patrickhlauke-issue5525 branch from 750742b to 24e413a Compare May 28, 2023 19:42
@bitwarden-bot
Copy link

Thank you for your contribution! We've added this to our internal Community PR board for review.
ID: PM-2432

@bitwarden-bot bitwarden-bot changed the title Desktop: Modify switch account dropdown/dialog for accessibility [PM-2432] Desktop: Modify switch account dropdown/dialog for accessibility May 28, 2023
@patrickhlauke patrickhlauke force-pushed the patrickhlauke-issue5525 branch from 24e413a to 98e73b7 Compare May 28, 2023 20:29
* Take out the confusing "Logged in as..." a11y text
* Use visible button text (with a few extra `sr-only` parts, for readability) as the button's accName
* Add the "Switch account" context to each of the buttons to make clear what they do
@patrickhlauke patrickhlauke force-pushed the patrickhlauke-issue5525 branch from 98e73b7 to 1fb80ac Compare May 28, 2023 20:31
@rr-bw rr-bw added the needs-qa Marks a PR as requiring QA approval label Oct 11, 2023
@rr-bw rr-bw self-assigned this Oct 11, 2023
Copy link
Contributor

@rr-bw rr-bw left a comment

Choose a reason for hiding this comment

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

Thanks @patrickhlauke. Looks good!

@rr-bw rr-bw requested review from a team and shane-melton and removed request for a team October 11, 2023 18:50
@patrickhlauke patrickhlauke requested a review from a team as a code owner October 12, 2023 00:06
@rr-bw rr-bw removed the needs-qa Marks a PR as requiring QA approval label Oct 31, 2023
@rr-bw
Copy link
Contributor

rr-bw commented Oct 31, 2023

QA approved, thanks @patrickhlauke!

@rr-bw rr-bw merged commit 22a138a into bitwarden:master Oct 31, 2023
@patrickhlauke patrickhlauke deleted the patrickhlauke-issue5525 branch October 31, 2023 18:08
BlackDex pushed a commit to BlackDex/bitwarden-clients that referenced this pull request Nov 21, 2023
…ility (bitwarden#5529)

* Tweak account switcher button

- if it opens a dialog, it should advertise this with `aria-haspopup="dialog"`, not `aria-haspopup="menu"`
- if it opens a dialog, the `aria-expanded` is pointless (as the user will never get back out into the underlying page to check if it's expanded or collapsed, since it's for a dialog not a disclosure widget or menu)

* Make two variants for button to sort out `aria-label` on logged-in case

* Remove `aria-controls` for button

as it's a dialog that opens, not a disclosure, this is irrelevant

* Fix `overlayPostition` typo

* Simplify approach

just use existing single button, but add visually hidden extra "Switch account" to accName

* Tweak account switch buttons in dialog/dropdown

* Take out the confusing "Logged in as..." a11y text
* Use visible button text (with a few extra `sr-only` parts, for readability) as the button's accName
* Add the "Switch account" context to each of the buttons to make clear what they do
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.

a11y: Desktop switch account menu announced incorrectly/confusingly by screen readers
4 participants