Skip to content

Commit c693203

Browse files
committed
fix: a11y: add aria-posinset for virtualized
For `react-virtualized` lists. [From MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset): > The aria-posinset attribute defines an element's number or position > in the current set of listitems or treeitems > when not all items are present in the DOM.
1 parent e47255e commit c693203

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
- keep the order of contacts when calling getContactsByIds #4651
1010

11+
### Fixed
12+
- accessibility: fix screen readers announcing incorrect list sizes
13+
1114
<a id="1_54_0"></a>
1215

1316
## [1.54.0] - 2025-02-15

packages/frontend/src/components/chat/ChatListItemRow.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ export const ChatListItemRowChat = React.memo<{
5757
const chatId = chatListIds[index]
5858

5959
return (
60-
<li style={style}>
60+
<li
61+
style={style}
62+
aria-posinset={index + 1}
63+
aria-setsize={chatListIds.length}
64+
>
6165
<ChatListItem
6266
isSelected={selectedChatId === chatId}
6367
chatListItem={chatCache[chatId] || undefined}
@@ -98,7 +102,11 @@ export const ChatListItemRowContact = React.memo<{
98102
}}
99103
/>
100104
) : (
101-
<li style={style}>
105+
<li
106+
style={style}
107+
aria-posinset={index + 1}
108+
aria-setsize={contactIds.length}
109+
>
102110
<PlaceholderChatListItem />
103111
</li>
104112
)
@@ -116,7 +124,11 @@ export const ChatListItemRowMessage = React.memo<{
116124
const accountId = selectedAccountId()
117125

118126
return (
119-
<li style={style}>
127+
<li
128+
style={style}
129+
aria-posinset={index + 1}
130+
aria-setsize={messageResultIds.length}
131+
>
120132
{messageSearchResult ? (
121133
<ChatListItemMessageResult
122134
queryStr={queryStr || ''}

0 commit comments

Comments
 (0)