Skip to content

Commit 814f4a8

Browse files
authored
fix: tooltip on presence (#30474)
1 parent 475504d commit 814f4a8

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/components/views/avatars/RoomAvatarView.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,10 @@ export function RoomAvatarView({ room }: RoomAvatarViewProps): JSX.Element {
5555
);
5656
}
5757

58-
type PresenceDecorationProps = {
59-
/**
60-
* The presence of the user in the DM room.
61-
*/
62-
presence: NonNullable<Presence>;
63-
};
64-
6558
/**
66-
* Component to display the presence of a user in a DM room.
59+
* Get the decoration for the avatar based on the presence.
6760
*/
68-
function PresenceDecoration({ presence }: PresenceDecorationProps): JSX.Element {
61+
function getPresenceDecoration(presence: Presence): JSX.Element {
6962
switch (presence) {
7063
case Presence.Online:
7164
return (
@@ -142,7 +135,7 @@ function getAvatarDecoration(decoration: AvatarBadgeDecoration, presence: Presen
142135
/>
143136
);
144137
} else if (decoration === AvatarBadgeDecoration.Presence) {
145-
return <PresenceDecoration presence={presence!} />;
138+
return getPresenceDecoration(presence!);
146139
}
147140
}
148141

test/unit-tests/components/views/avatars/__snapshots__/RoomAvatarView-test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ exports[`<RoomAvatarView /> should render the AWAY presence 1`] = `
179179
</span>
180180
<svg
181181
aria-label="Away"
182+
aria-labelledby="«r14»"
182183
class="mx_RoomAvatarView_PresenceDecoration"
183184
color="var(--cpd-color-icon-quaternary)"
184185
fill="currentColor"
@@ -234,6 +235,7 @@ exports[`<RoomAvatarView /> should render the BUSY presence 1`] = `
234235
</span>
235236
<svg
236237
aria-label="Busy"
238+
aria-labelledby="«ru»"
237239
class="mx_RoomAvatarView_PresenceDecoration"
238240
color="var(--cpd-color-icon-tertiary)"
239241
fill="currentColor"
@@ -291,6 +293,7 @@ exports[`<RoomAvatarView /> should render the OFFLINE presence 1`] = `
291293
</span>
292294
<svg
293295
aria-label="Offline"
296+
aria-labelledby="«ro»"
294297
class="mx_RoomAvatarView_PresenceDecoration"
295298
color="var(--cpd-color-icon-tertiary)"
296299
fill="currentColor"
@@ -348,6 +351,7 @@ exports[`<RoomAvatarView /> should render the ONLINE presence 1`] = `
348351
</span>
349352
<svg
350353
aria-label="Online"
354+
aria-labelledby="«ri»"
351355
class="mx_RoomAvatarView_PresenceDecoration"
352356
color="var(--cpd-color-icon-accent-primary)"
353357
fill="currentColor"

0 commit comments

Comments
 (0)