Merge pull request #5968 from element-hq/feature/bma/a11y/letterAvatar

Ensure that avatars always have a content description.
This commit is contained in:
Benoit Marty 2026-01-05 10:21:49 +01:00 committed by GitHub
commit cf4e54fed6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 11 additions and 11 deletions

View file

@ -91,7 +91,7 @@ class ContributesNodeProcessor(
.addAnnotation(Binds::class) .addAnnotation(Binds::class)
.addAnnotation(IntoMap::class) .addAnnotation(IntoMap::class)
.addAnnotation( .addAnnotation(
AnnotationSpec.Companion.builder(ClassName.bestGuess(nodeKeyFqName.asString())).addMember( AnnotationSpec.builder(ClassName.bestGuess(nodeKeyFqName.asString())).addMember(
CLASS_PLACEHOLDER, CLASS_PLACEHOLDER,
ClassName.bestGuess(ksClass.qualifiedName!!.asString()) ClassName.bestGuess(ksClass.qualifiedName!!.asString())
).build() ).build()

View file

@ -49,7 +49,7 @@ fun GroupHeaderView(
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
// Ignore isHighlighted for now, we need a design decision on it. // Ignore isHighlighted for now, we need a design decision on it.
val backgroundColor = Color.Companion.Transparent val backgroundColor = Color.Transparent
val shape = RoundedCornerShape(CORNER_RADIUS) val shape = RoundedCornerShape(CORNER_RADIUS)
Box( Box(

View file

@ -404,7 +404,7 @@ private fun RoomHeaderSection(
}.toImmutableList(), }.toImmutableList(),
isTombstoned = isTombstoned, isTombstoned = isTombstoned,
), ),
contentDescription = avatarUrl?.let { stringResource(CommonStrings.a11y_room_avatar) }, contentDescription = stringResource(CommonStrings.a11y_room_avatar),
modifier = Modifier modifier = Modifier
.clickable( .clickable(
enabled = avatarUrl != null, enabled = avatarUrl != null,

View file

@ -115,7 +115,7 @@ private fun SpaceInfoSection(
Avatar( Avatar(
avatarData = AvatarData(roomId.value, name, avatarUrl, AvatarSize.SpaceListItem), avatarData = AvatarData(roomId.value, name, avatarUrl, AvatarSize.SpaceListItem),
avatarType = AvatarType.Space(), avatarType = AvatarType.Space(),
contentDescription = avatarUrl?.let { stringResource(CommonStrings.a11y_avatar) }, contentDescription = stringResource(CommonStrings.a11y_avatar),
) )
Spacer(Modifier.width(16.dp)) Spacer(Modifier.width(16.dp))
Column { Column {

View file

@ -66,7 +66,7 @@ fun UserProfileHeaderSection(
Avatar( Avatar(
avatarData = AvatarData(userId.value, userName, avatarUrl, AvatarSize.UserHeader), avatarData = AvatarData(userId.value, userName, avatarUrl, AvatarSize.UserHeader),
avatarType = AvatarType.User, avatarType = AvatarType.User,
contentDescription = avatarUrl?.let { stringResource(CommonStrings.a11y_user_avatar) }, contentDescription = stringResource(CommonStrings.a11y_user_avatar),
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.clickable( .clickable(

View file

@ -34,7 +34,7 @@ fun SelectedIndicatorAtom(
Icon( Icon(
modifier = modifier.toggleable( modifier = modifier.toggleable(
value = true, value = true,
role = Role.Companion.Checkbox, role = Role.Checkbox,
enabled = enabled, enabled = enabled,
onValueChange = {}, onValueChange = {},
), ),

View file

@ -59,7 +59,7 @@ fun DmAvatars(
Avatar( Avatar(
avatarData = userAvatarData, avatarData = userAvatarData,
avatarType = AvatarType.User, avatarType = AvatarType.User,
contentDescription = userAvatarData.url?.let { stringResource(CommonStrings.a11y_your_avatar) }, contentDescription = stringResource(CommonStrings.a11y_your_avatar),
modifier = Modifier modifier = Modifier
.align(Alignment.BottomStart) .align(Alignment.BottomStart)
.graphicsLayer { .graphicsLayer {
@ -94,7 +94,7 @@ fun DmAvatars(
Avatar( Avatar(
avatarData = otherUserAvatarData, avatarData = otherUserAvatarData,
avatarType = AvatarType.User, avatarType = AvatarType.User,
contentDescription = otherUserAvatarData.url?.let { stringResource(CommonStrings.a11y_other_user_avatar) }, contentDescription = stringResource(CommonStrings.a11y_other_user_avatar),
modifier = Modifier modifier = Modifier
.align(Alignment.TopEnd) .align(Alignment.TopEnd)
.clip(CircleShape) .clip(CircleShape)

View file

@ -36,7 +36,7 @@ internal fun ImageAvatar(
SubcomposeAsyncImage( SubcomposeAsyncImage(
model = avatarData, model = avatarData,
contentDescription = contentDescription, contentDescription = contentDescription,
contentScale = ContentScale.Companion.Crop, contentScale = ContentScale.Crop,
modifier = modifier modifier = modifier
.size(size) .size(size)
.clip(avatarShape) .clip(avatarShape)

View file

@ -50,6 +50,6 @@ object ElementNavigationBarItemDefaults {
selectedTextColor = ElementTheme.colors.textPrimary, selectedTextColor = ElementTheme.colors.textPrimary,
unselectedIconColor = ElementTheme.colors.iconTertiary, unselectedIconColor = ElementTheme.colors.iconTertiary,
unselectedTextColor = ElementTheme.colors.textDisabled, unselectedTextColor = ElementTheme.colors.textDisabled,
selectedIndicatorColor = Color.Companion.Transparent, selectedIndicatorColor = Color.Transparent,
) )
} }

View file

@ -27,7 +27,7 @@ class TestParentNode<Child : Node>(
private val childNodeFactory: (buildContext: BuildContext, plugins: List<Plugin>) -> Child, private val childNodeFactory: (buildContext: BuildContext, plugins: List<Plugin>) -> Child,
) : DependencyInjectionGraphOwner, ) : DependencyInjectionGraphOwner,
Node( Node(
buildContext = BuildContext.Companion.root(savedStateMap = null), buildContext = BuildContext.root(savedStateMap = null),
plugins = emptyList(), plugins = emptyList(),
view = EmptyNodeView, view = EmptyNodeView,
) { ) {