Skip to content

Commit 44df2d2

Browse files
committed
[a11y] Improve accessibility of media controller
1 parent 4641ae6 commit 44df2d2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/MediaPlayerControllerView.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,20 +181,26 @@ fun MediaPlayerControllerView(
181181
style = ElementTheme.typography.fontBodyXsMedium,
182182
)
183183
if (state.canMute) {
184+
val a11yUnmute = stringResource(CommonStrings.common_unmute)
185+
val a11yMute = stringResource(CommonStrings.common_mute)
184186
IconButton(
185187
onClick = onToggleMute,
188+
modifier = Modifier
189+
.semantics {
190+
stateDescription = if (state.isMuted) a11yUnmute else a11yMute
191+
},
186192
) {
187193
if (state.isMuted) {
188194
Icon(
189195
imageVector = CompoundIcons.VolumeOffSolid(),
190196
tint = ElementTheme.colors.iconPrimary,
191-
contentDescription = stringResource(CommonStrings.common_unmute)
197+
contentDescription = null,
192198
)
193199
} else {
194200
Icon(
195201
imageVector = CompoundIcons.VolumeOnSolid(),
196202
tint = ElementTheme.colors.iconPrimary,
197-
contentDescription = stringResource(CommonStrings.common_mute)
203+
contentDescription = null,
198204
)
199205
}
200206
}

0 commit comments

Comments
 (0)