Skip to content

Commit d7cafbd

Browse files
[A11y bug] Participant changed announcements mk 2 (#2546)
* Add announcer to mediaGallery * build API files * Change files * update hook so not broken * fix hook mark 2 * fix linting * move comment * update announcement to account for displayNames * change ariaLive to polite * move hook to utils file * update API files * fix linter issues * update to use selectors * get Name announcements working * add logic to restrict the number of user announced * remove timers * remove unneeded state variables * update API files and fix comments * fix the linter * updates per comments * fix lint * update string generation logic * clean up string parsing function * fix nit * removeing the else * update strings logic * add tests * update strings and add tests * build API files * fix lint * update strings * update string params * update API docs * Add enzyme test scaffolding * Implement 1 named participant joined * implement 1 participant left * assert all announcements * do not handle the case when one participant joins and another leaves at the same time * Implement 2 and 3 participants joining * Implement 2 and 3 participants joining * implement up to 3 participants joining and leaving * implement more than 3 participants joining and leaving * add failing tests for unnamed participant * create sorted participants * handle multiple unnamed participants * added tests for multimixed participants * Change files * Duplicate change files for beta release * Add failing test and undo invalid whoJoined and whoLeft conditional * create deep comparison for participants * perform deep comparisons after serialization * Change files * Duplicate change files for beta release * fix lint issue * fix nits * remove string overloads * update hook to useRef Co-authored-by: Prathmesh Prabhu <82062616+prprabhu-ms@users.noreply.github.com>
1 parent 32e8849 commit d7cafbd

15 files changed

Lines changed: 626 additions & 8 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add anouncement strings to the composites so the narrator will announce when someone joins or leaves",
4+
"packageName": "@azure/communication-react",
5+
"email": "94866715+dmceachernmsft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Introduces announcements for when participants come and go from a call.",
4+
"packageName": "@azure/communication-react",
5+
"email": "94866715+dmceachernmsft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add anouncement strings to the composites so the narrator will announce when someone joins or leaves",
4+
"packageName": "@azure/communication-react",
5+
"email": "94866715+dmceachernmsft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Introduces announcements for when participants come and go from a call.",
4+
"packageName": "@azure/communication-react",
5+
"email": "94866715+dmceachernmsft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/communication-react/review/beta/communication-react.api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,10 @@ export interface CallCompositeStrings {
541541
lobbyScreenConnectingToCallTitle: string;
542542
lobbyScreenWaitingToBeAdmittedMoreDetails?: string;
543543
lobbyScreenWaitingToBeAdmittedTitle: string;
544+
manyParticipantsJoined: string;
545+
manyParticipantsLeft: string;
546+
manyUnnamedParticipantsJoined: string;
547+
manyUnnamedParticipantsLeft: string;
544548
microphonePermissionDenied: string;
545549
microphoneToggleInLobbyNotAllowed: string;
546550
moreButtonCallingLabel: string;
@@ -550,6 +554,8 @@ export interface CallCompositeStrings {
550554
openDialpadButtonLabel: string;
551555
openDtmfDialpadLabel: string;
552556
outboundCallingNoticeString: string;
557+
participantJoinedNoticeString: string;
558+
participantLeftNoticeString: string;
553559
peopleButtonLabel: string;
554560
peopleButtonTooltipClose: string;
555561
peopleButtonTooltipOpen: string;
@@ -571,6 +577,11 @@ export interface CallCompositeStrings {
571577
roomNotFoundTitle: string;
572578
soundLabel: string;
573579
startCallButtonLabel: string;
580+
threeParticipantJoinedNoticeString: string;
581+
threeParticipantLeftNoticeString: string;
582+
twoParticipantJoinedNoticeString: string;
583+
twoParticipantLeftNoticeString: string;
584+
unnamedParticipantString: string;
574585
}
575586

576587
// @public

packages/communication-react/review/stable/communication-react.api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,17 +415,28 @@ export interface CallCompositeStrings {
415415
lobbyScreenConnectingToCallTitle: string;
416416
lobbyScreenWaitingToBeAdmittedMoreDetails?: string;
417417
lobbyScreenWaitingToBeAdmittedTitle: string;
418+
manyParticipantsJoined: string;
419+
manyParticipantsLeft: string;
420+
manyUnnamedParticipantsJoined: string;
421+
manyUnnamedParticipantsLeft: string;
418422
microphonePermissionDenied: string;
419423
microphoneToggleInLobbyNotAllowed: string;
420424
mutedMessage: string;
421425
networkReconnectMoreDetails: string;
422426
networkReconnectTitle: string;
427+
participantJoinedNoticeString: string;
428+
participantLeftNoticeString: string;
423429
privacyPolicy: string;
424430
rejoinCallButtonLabel: string;
425431
removedFromCallMoreDetails?: string;
426432
removedFromCallTitle: string;
427433
soundLabel: string;
428434
startCallButtonLabel: string;
435+
threeParticipantJoinedNoticeString: string;
436+
threeParticipantLeftNoticeString: string;
437+
twoParticipantJoinedNoticeString: string;
438+
twoParticipantLeftNoticeString: string;
439+
unnamedParticipantString: string;
429440
}
430441

431442
// @public

packages/react-composites/review/beta/react-composites.api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ export interface CallCompositeStrings {
390390
lobbyScreenConnectingToCallTitle: string;
391391
lobbyScreenWaitingToBeAdmittedMoreDetails?: string;
392392
lobbyScreenWaitingToBeAdmittedTitle: string;
393+
manyParticipantsJoined: string;
394+
manyParticipantsLeft: string;
395+
manyUnnamedParticipantsJoined: string;
396+
manyUnnamedParticipantsLeft: string;
393397
microphonePermissionDenied: string;
394398
microphoneToggleInLobbyNotAllowed: string;
395399
moreButtonCallingLabel: string;
@@ -399,6 +403,8 @@ export interface CallCompositeStrings {
399403
openDialpadButtonLabel: string;
400404
openDtmfDialpadLabel: string;
401405
outboundCallingNoticeString: string;
406+
participantJoinedNoticeString: string;
407+
participantLeftNoticeString: string;
402408
peopleButtonLabel: string;
403409
peopleButtonTooltipClose: string;
404410
peopleButtonTooltipOpen: string;
@@ -420,6 +426,11 @@ export interface CallCompositeStrings {
420426
roomNotFoundTitle: string;
421427
soundLabel: string;
422428
startCallButtonLabel: string;
429+
threeParticipantJoinedNoticeString: string;
430+
threeParticipantLeftNoticeString: string;
431+
twoParticipantJoinedNoticeString: string;
432+
twoParticipantLeftNoticeString: string;
433+
unnamedParticipantString: string;
423434
}
424435

425436
// @public

packages/react-composites/review/stable/react-composites.api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,28 @@ export interface CallCompositeStrings {
318318
lobbyScreenConnectingToCallTitle: string;
319319
lobbyScreenWaitingToBeAdmittedMoreDetails?: string;
320320
lobbyScreenWaitingToBeAdmittedTitle: string;
321+
manyParticipantsJoined: string;
322+
manyParticipantsLeft: string;
323+
manyUnnamedParticipantsJoined: string;
324+
manyUnnamedParticipantsLeft: string;
321325
microphonePermissionDenied: string;
322326
microphoneToggleInLobbyNotAllowed: string;
323327
mutedMessage: string;
324328
networkReconnectMoreDetails: string;
325329
networkReconnectTitle: string;
330+
participantJoinedNoticeString: string;
331+
participantLeftNoticeString: string;
326332
privacyPolicy: string;
327333
rejoinCallButtonLabel: string;
328334
removedFromCallMoreDetails?: string;
329335
removedFromCallTitle: string;
330336
soundLabel: string;
331337
startCallButtonLabel: string;
338+
threeParticipantJoinedNoticeString: string;
339+
threeParticipantLeftNoticeString: string;
340+
twoParticipantJoinedNoticeString: string;
341+
twoParticipantLeftNoticeString: string;
342+
unnamedParticipantString: string;
332343
}
333344

334345
// @public

packages/react-composites/src/composites/CallComposite/MockCallAdapter.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { AudioDeviceInfo, Call, DtmfTone, PermissionConstraints, VideoDeviceInfo
66
import { EnvironmentInfo } from '@azure/communication-calling';
77
/* @conditional-compile-remove(rooms) */
88
import { Role } from '@internal/react-components';
9+
import { EventEmitter } from 'stream';
910
import { CallAdapter, CallAdapterState } from './adapter';
1011

1112
/**
@@ -30,15 +31,23 @@ export class MockCallAdapter implements CallAdapter {
3031

3132
state: CallAdapterState;
3233

34+
private emitter = new EventEmitter();
35+
36+
setState(state: CallAdapterState): void {
37+
this.state = state;
38+
this.emitter.emit('stateChanged', state);
39+
}
40+
3341
addParticipant(): Promise<void> {
3442
throw Error('addParticipant not implemented');
3543
}
36-
onStateChange(): void {
37-
return;
44+
onStateChange(handler: (state: CallAdapterState) => void): void {
45+
this.emitter.addListener('stateChanged', handler);
3846
}
39-
offStateChange(): void {
40-
return;
47+
offStateChange(handler: (state: CallAdapterState) => void): void {
48+
this.emitter.removeListener('stateChanged', handler);
4149
}
50+
4251
getState(): CallAdapterState {
4352
return this.state;
4453
}

packages/react-composites/src/composites/CallComposite/Strings.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,4 +327,48 @@ export interface CallCompositeStrings {
327327
* Label disaplayed on the lobby screen during a 1:1 outbound call.
328328
*/
329329
outboundCallingNoticeString: string;
330+
/**
331+
* Notice to be announced by narrator when a participant joins a call
332+
*/
333+
participantJoinedNoticeString: string;
334+
/**
335+
* Notice to be announced by narrator when a participant joins a call
336+
*/
337+
twoParticipantJoinedNoticeString: string;
338+
/**
339+
* Notice to be announced by narrator when a participant joins a call
340+
*/
341+
threeParticipantJoinedNoticeString: string;
342+
/**
343+
* Notice to be announced by narrator when a participant leaves a call
344+
*/
345+
participantLeftNoticeString: string;
346+
/**
347+
* Notice to be announced by narrator when 2 participants leave a call
348+
*/
349+
twoParticipantLeftNoticeString: string;
350+
/**
351+
* Notice to be announced by narrator when 3 participants leave a call
352+
*/
353+
threeParticipantLeftNoticeString: string;
354+
/**
355+
* string to be used to announce a change in participant if they have no displayName
356+
*/
357+
unnamedParticipantString: string;
358+
/**
359+
* string to be used to announce when more than 3 participants have joined at the same time.
360+
*/
361+
manyParticipantsJoined: string;
362+
/**
363+
* string to be used to announce when more than 3 participants have left at the same time.
364+
*/
365+
manyParticipantsLeft: string;
366+
/**
367+
* string to be used to announce when multiple unnamed participants have joined at the same time.
368+
*/
369+
manyUnnamedParticipantsJoined: string;
370+
/**
371+
* string to be used to announce when multiple unnamed participants have left at the same time.
372+
*/
373+
manyUnnamedParticipantsLeft: string;
330374
}

0 commit comments

Comments
 (0)