Skip to content

Commit 760261e

Browse files
committed
improvement: a11y: aria-label for accounts list
1 parent a5f8b1b commit 760261e

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

packages/frontend/src/components/AccountListSidebar/AccountListSidebar.tsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function AccountListSidebar({
4646
}: Props) {
4747
const tx = useTranslationFunction()
4848

49-
const accountsListRef = useRef<HTMLDivElement>(null)
49+
const accountsListRef = useRef<HTMLUListElement>(null)
5050
const { openDialog } = useDialog()
5151
const [accounts, setAccounts] = useState<number[]>([])
5252
const [{ accounts: noficationSettings }] = useAccountNotificationStore()
@@ -144,27 +144,35 @@ export default function AccountListSidebar({
144144
data-tauri-drag-region
145145
/>
146146
)}
147-
<div
147+
<ul
148148
ref={accountsListRef}
149+
// Perhaps just "Profiles" would be more appropriate,
150+
// because you can do other things with profiles in this list,
151+
// but we have the same on Android.
152+
aria-label={tx('switch_account')}
149153
className={styles.accountList}
150154
onScroll={updateHoverInfoPosition}
151155
>
152156
<RovingTabindexProvider wrapperElementRef={accountsListRef}>
153157
{accounts.map(id => (
154-
<AccountItem
155-
key={id}
156-
accountId={id}
157-
isSelected={selectedAccountId === id}
158-
onSelectAccount={selectAccount}
159-
openAccountDeletionScreen={openAccountDeletionScreen}
160-
updateAccountForHoverInfo={updateAccountForHoverInfo}
161-
syncAllAccounts={syncAllAccounts}
162-
muted={noficationSettings[id]?.muted || false}
163-
/>
158+
<li>
159+
<AccountItem
160+
key={id}
161+
accountId={id}
162+
isSelected={selectedAccountId === id}
163+
onSelectAccount={selectAccount}
164+
openAccountDeletionScreen={openAccountDeletionScreen}
165+
updateAccountForHoverInfo={updateAccountForHoverInfo}
166+
syncAllAccounts={syncAllAccounts}
167+
muted={noficationSettings[id]?.muted || false}
168+
/>
169+
</li>
164170
))}
165-
<AddAccountButton onClick={onAddAccount} />
171+
<li>
172+
<AddAccountButton onClick={onAddAccount} />
173+
</li>
166174
</RovingTabindexProvider>
167-
</div>
175+
</ul>
168176
{/* The condition is the same as in https://github.com/deltachat/deltachat-desktop/blob/63af023437ff1828a27de2da37bf94ab180ec528/src/renderer/contexts/KeybindingsContext.tsx#L26 */}
169177
{window.__screen === Screens.Main && (
170178
<div className={styles.buttonsContainer}>

packages/frontend/src/components/AccountListSidebar/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
--als-avatar-margin: 5px;
5151
--als-active-indicator-color: white;
5252

53+
margin: 0;
54+
padding: 0;
55+
list-style: none;
56+
5357
align-items: center;
5458
display: flex;
5559
flex-direction: column;

0 commit comments

Comments
 (0)