From 22a138a46f9a8f1802c9ba4cc889e55dfd08d432 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Tue, 31 Oct 2023 17:55:43 +0000 Subject: [PATCH] [PM-2432] Desktop: Modify switch account dropdown/dialog for accessibility (#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 --- .../layout/account-switcher.component.html | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/apps/desktop/src/app/layout/account-switcher.component.html b/apps/desktop/src/app/layout/account-switcher.component.html index d6fd137bff..5110969b0c 100644 --- a/apps/desktop/src/app/layout/account-switcher.component.html +++ b/apps/desktop/src/app/layout/account-switcher.component.html @@ -6,9 +6,7 @@ cdkOverlayOrigin #trigger="cdkOverlayOrigin" [hidden]="!showSwitcher" - aria-haspopup="menu" - aria-controls="cdk-overlay-container" - [attr.aria-expanded]="isOpen" + aria-haspopup="dialog" > - {{ activeAccount.email }} + {{ activeAccount.email + }} ({{ "switchAccount" | i18n }}) {{ "switchAccount" | i18n }} @@ -54,13 +55,7 @@ aria-modal="true" >
-