Skip to content

Commit 708fd58

Browse files
committed
fix(space widget): Voiceover announcement in peoplelist item
1 parent 3696ee7 commit 708fd58

File tree

4 files changed

+64
-15
lines changed

4 files changed

+64
-15
lines changed

packages/node_modules/@webex/react-component-people-list/src/__snapshots__/index.test.js.snap

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ exports[`PeopleList component renders a group of participants as moderator 1`] =
2020
className="webex-people-list list listNonVirtualized"
2121
>
2222
<div
23+
aria-label="Participants, list of 2 items"
2324
className="webex-people-group group"
25+
role="group"
26+
tabIndex={0}
2427
>
2528
<ListItemHeader
2629
className="webex-people-group-title title"
@@ -31,8 +34,15 @@ exports[`PeopleList component renders a group of participants as moderator 1`] =
3134
type=""
3235
/>
3336
</div>
34-
<div>
37+
<div
38+
aria-label="Dr Dre, 1 of 2"
39+
aria-posinset={1}
40+
aria-setsize={2}
41+
role="listitem"
42+
tabIndex={0}
43+
>
3544
<Person
45+
aria-hidden="true"
3646
canEdit={true}
3747
displayName="Dr Dre"
3848
emailAddress="dreday@deathrowrecords.net"
@@ -43,8 +53,15 @@ exports[`PeopleList component renders a group of participants as moderator 1`] =
4353
onRemove={[Function]}
4454
/>
4555
</div>
46-
<div>
56+
<div
57+
aria-label="Jimmy Iovine, 2 of 2"
58+
aria-posinset={2}
59+
aria-setsize={2}
60+
role="listitem"
61+
tabIndex={0}
62+
>
4763
<Person
64+
aria-hidden="true"
4865
canEdit={true}
4966
displayName="Jimmy Iovine"
5067
emailAddress=""

packages/node_modules/@webex/react-component-people-list/src/__snapshots__/list-item.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
exports[`PeopleListItem component renders a local participant properly 1`] = `
44
<div
5+
aria-hidden="true"
56
className="webex-people-list-item item"
67
title="Dr Dre"
78
>
89
<ForwardRef(render)
910
onClick={[Function]}
10-
title="Dr Dre"
1111
type="small"
1212
>
1313
<ListItemSection
@@ -44,12 +44,12 @@ exports[`PeopleListItem component renders a local participant properly 1`] = `
4444

4545
exports[`PeopleListItem component renders a local participant with email properly 1`] = `
4646
<div
47+
aria-hidden="true"
4748
className="webex-people-list-item item"
4849
title="Dr Dre (dreday@deathrowrecords.net)"
4950
>
5051
<ForwardRef(render)
5152
onClick={[Function]}
52-
title="Dr Dre"
5353
type="small"
5454
>
5555
<ListItemSection
@@ -86,12 +86,12 @@ exports[`PeopleListItem component renders a local participant with email properl
8686

8787
exports[`PeopleListItem component renders an editable participant properly 1`] = `
8888
<div
89+
aria-hidden="true"
8990
className="webex-people-list-item item"
9091
title="Jimmy Iovine"
9192
>
9293
<ForwardRef(render)
9394
onClick={[Function]}
94-
title="Jimmy Iovine"
9595
type="small"
9696
>
9797
<ListItemSection
@@ -188,12 +188,12 @@ exports[`PeopleListItem component renders an editable participant properly 1`] =
188188

189189
exports[`PeopleListItem component renders an external participant properly 1`] = `
190190
<div
191+
aria-hidden="true"
191192
className="webex-people-list-item item external webex-people-list-item-external"
192193
title="Jimmy Iovine"
193194
>
194195
<ForwardRef(render)
195196
onClick={[Function]}
196-
title="Jimmy Iovine"
197197
type="small"
198198
>
199199
<ListItemSection

packages/node_modules/@webex/react-component-people-list/src/index.js

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function PeopleList({
5353
}
5454
// Rows for each person
5555
item.people.forEach((person) => {
56-
totalRows.push({type: 'person', details: person});
56+
totalRows.push({type: 'person', details: person, parent: item.label});
5757
});
5858
});
5959

@@ -64,17 +64,36 @@ function PeopleList({
6464
}) {
6565
/* eslint-enable react/prop-types */
6666
if (totalRows[index].type === 'header') {
67+
const groupLabel = totalRows[index].details;
68+
const group = items.find((item) => item.label === groupLabel);
69+
const groupCount = group ? group.people.length : 0;
70+
6771
return (
68-
<div style={style} className={classNames('webex-people-group', styles.group)} key={totalRows[index].details}>
69-
{
70-
totalRows[index].details
71-
&& <ListItemHeader className={classNames('webex-people-group-title', styles.title)} header={totalRows[index].details} isReadOnly />
72-
}
72+
<div
73+
style={style}
74+
className={classNames('webex-people-group', styles.group)}
75+
role="group"
76+
aria-label={`${groupLabel}, list of ${groupCount} ${groupCount === 1 ? 'item' : 'items'}`}
77+
tabIndex={0}
78+
>
79+
{groupLabel && (
80+
<ListItemHeader
81+
className={classNames('webex-people-group-title', styles.title)}
82+
header={groupLabel}
83+
isReadOnly
84+
/>
85+
)}
7386
</div>
7487
);
7588
}
7689

7790
const person = totalRows[index].details;
91+
const parentGroup = items.find((item) =>
92+
item.people.some((p) => p.id === person.id));
93+
const groupCount = parentGroup ? parentGroup.people.length : 0;
94+
const posInSet = parentGroup
95+
? parentGroup.people.findIndex((p) => p.id === person.id) + 1
96+
: 1;
7897

7998
const handleItemClick = () => {
8099
onItemClick(person);
@@ -85,7 +104,15 @@ function PeopleList({
85104
};
86105

87106
return (
88-
<div key={key} style={style}>
107+
<div
108+
key={key}
109+
style={style}
110+
role="listitem"
111+
aria-setsize={groupCount}
112+
aria-posinset={posInSet}
113+
aria-label={`${person.displayName || person.name}, ${posInSet} of ${groupCount}`}
114+
tabIndex={0}
115+
>
89116
<Person
90117
canEdit={showEdit}
91118
displayName={person.displayName || person.name}
@@ -96,14 +123,18 @@ function PeopleList({
96123
id={person.id}
97124
isExternal={person.isExternal}
98125
isPending={person.isPending}
126+
aria-hidden="true"
99127
/>
100128
</div>
101129
);
102130
}
103131

104132
function onRowsRendered({startIndex, stopIndex}) {
105133
// gets users from displayed rows that are not labels
106-
const userIds = totalRows.slice(startIndex, stopIndex + 1).filter((row) => row.type === 'person').map((p) => p.details.id);
134+
const userIds = totalRows
135+
.slice(startIndex, stopIndex + 1)
136+
.filter((row) => row.type === 'person')
137+
.map((p) => p.details.id);
107138

108139
onDisplayUsers(userIds);
109140
}

packages/node_modules/@webex/react-component-people-list/src/list-item.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ function Person({
8585
}
8686
)}
8787
title={detailName}
88+
aria-hidden="true"
8889
>
89-
<ListItem onClick={handleAction} title={displayName} type="small">
90+
<ListItem onClick={handleAction} type="small">
9091
<ListItemSection position="left">
9192
<div className={classNames('webex-people-list-avatar', styles.avatar)}>
9293
<PresenceAvatar avatarId={id} name={displayName} size={28} />

0 commit comments

Comments
 (0)