Skip to content

Commit b61ba58

Browse files
committed
Name the channel header avatar for TalkBack
1 parent ad0378d commit b61ba58

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/header

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/header/ChannelHeader.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import androidx.compose.ui.platform.testTag
3333
import androidx.compose.ui.res.painterResource
3434
import androidx.compose.ui.res.stringResource
3535
import androidx.compose.ui.semantics.Role
36+
import androidx.compose.ui.semantics.contentDescription
37+
import androidx.compose.ui.semantics.semantics
3638
import androidx.compose.ui.text.style.TextOverflow
3739
import androidx.compose.ui.tooling.preview.Preview
3840
import androidx.compose.ui.unit.dp
@@ -274,6 +276,7 @@ internal fun DefaultChannelHeaderTrailingContent(
274276
onClick: ((Channel) -> Unit)?,
275277
onClickLabel: String? = null,
276278
) {
279+
val avatarLabel = ChatTheme.channelNameFormatter.formatChannelName(channel, currentUser)
277280
ChatTheme.componentFactory.ChannelAvatar(
278281
params = ChannelAvatarParams(
279282
modifier = Modifier
@@ -284,6 +287,9 @@ internal fun DefaultChannelHeaderTrailingContent(
284287
onClickLabel = onClickLabel,
285288
role = Role.Button,
286289
) { callback(channel) }
290+
.semantics(mergeDescendants = true) {
291+
contentDescription = avatarLabel
292+
}
287293
},
288294
channel = channel,
289295
currentUser = currentUser,

0 commit comments

Comments
 (0)