Skip to content

Commit b108464

Browse files
committed
Label message attachment tap action for TalkBack
Image, video, file and link attachments in the message list previously announced as "double-tap to activate" — generic, no verb. The `combinedClickable` on each of those attachment containers had no `onClickLabel`, so TalkBack fell back to the platform default. Add `onClickLabel = "Open attachment"` to `MediaAttachmentContent`, `FileAttachmentContent`, and `LinkAttachmentContent`. TalkBack now reads "<type> attachment, double tap to Open attachment" for images and videos, and "<filename>, <size>, double tap to Open attachment" for files (the inner Texts already carry the name and size). Adds `stream_compose_message_attachment_open` across the 7 supported locales. No public API surface change. Poll, location, giphy and audio attachments are left for a follow-up — each has its own composable and a different interaction model. Multi- attachment disambiguation (e.g. "Image 1 of 4") is also a separate follow-up; it needs index/total plumbing through the multi-attachment grid.
1 parent 2d55592 commit b108464

11 files changed

Lines changed: 17 additions & 0 deletions

File tree

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/FileAttachmentContent.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import androidx.compose.ui.draw.clip
3737
import androidx.compose.ui.graphics.Color
3838
import androidx.compose.ui.layout.ContentScale
3939
import androidx.compose.ui.platform.testTag
40+
import androidx.compose.ui.res.stringResource
4041
import androidx.compose.ui.text.TextStyle
4142
import androidx.compose.ui.text.style.TextOverflow
4243
import androidx.compose.ui.tooling.preview.Preview
@@ -45,6 +46,7 @@ import io.getstream.chat.android.client.utils.attachment.isAudio
4546
import io.getstream.chat.android.client.utils.attachment.isFile
4647
import io.getstream.chat.android.client.utils.attachment.isImage
4748
import io.getstream.chat.android.client.utils.attachment.isVideo
49+
import io.getstream.chat.android.compose.R
4850
import io.getstream.chat.android.compose.state.messages.attachments.AttachmentState
4951
import io.getstream.chat.android.compose.ui.attachments.preview.handler.AttachmentPreviewHandler
5052
import io.getstream.chat.android.compose.ui.components.LoadingIndicator
@@ -100,6 +102,7 @@ public fun FileAttachmentContent(
100102
)
101103
.testTag("Stream_MultipleFileAttachmentsColumn"),
102104
) {
105+
val openAttachmentLabel = stringResource(R.string.stream_compose_message_attachment_open)
103106
for (attachment in message.attachments) {
104107
if (attachment.isFile() || attachment.isAudio()) {
105108
ChatTheme.componentFactory.FileAttachmentItem(
@@ -114,6 +117,7 @@ public fun FileAttachmentContent(
114117
.combinedClickable(
115118
indication = ripple(),
116119
interactionSource = remember { MutableInteractionSource() },
120+
onClickLabel = openAttachmentLabel,
117121
onClick = { onItemClick(previewHandlers, attachment) },
118122
onLongClick = { attachmentState.onLongItemClick(message) },
119123
),

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/LinkAttachmentContent.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import androidx.compose.ui.layout.ContentScale
5050
import androidx.compose.ui.platform.LocalContext
5151
import androidx.compose.ui.platform.testTag
5252
import androidx.compose.ui.res.painterResource
53+
import androidx.compose.ui.res.stringResource
5354
import androidx.compose.ui.text.style.TextOverflow
5455
import androidx.compose.ui.tooling.preview.Preview
5556
import androidx.compose.ui.unit.dp
@@ -105,6 +106,7 @@ public fun LinkAttachmentContent(
105106
}
106107

107108
val context = LocalContext.current
109+
val openAttachmentLabel = stringResource(R.string.stream_compose_message_attachment_open)
108110
val textColor = MessageStyling.textColor(outgoing = state.isMine)
109111
val baseModifier = modifier
110112
.padding(MessageStyling.messageSectionPadding)
@@ -114,6 +116,7 @@ public fun LinkAttachmentContent(
114116
.combinedClickable(
115117
indication = ripple(),
116118
interactionSource = remember { MutableInteractionSource() },
119+
onClickLabel = openAttachmentLabel,
117120
onClick = {
118121
onItemClick(
119122
LinkAttachmentClickData(

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/MediaAttachmentContent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ internal fun MediaAttachmentContentItem(
452452
attachment.uploadState is Attachment.UploadState.InProgress ||
453453
attachment.uploadState is Attachment.UploadState.Idle
454454

455+
val openAttachmentLabel = stringResource(R.string.stream_compose_message_attachment_open)
455456
Box(
456457
modifier = modifier
457458
.semantics {
@@ -465,6 +466,7 @@ internal fun MediaAttachmentContentItem(
465466
.combinedClickable(
466467
interactionSource = remember { MutableInteractionSource() },
467468
indication = ripple(),
469+
onClickLabel = openAttachmentLabel,
468470
onClick = {
469471
if (message.syncStatus == SyncStatus.COMPLETED) {
470472
onItemClick(

stream-chat-android-compose/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
<string name="stream_compose_message_deleted_preview">"Mensaje eliminado"</string>
125125
<string name="stream_compose_message_item_open_thread">"Abrir hilo"</string>
126126
<string name="stream_compose_message_item_options">"Mostrar opciones del mensaje"</string>
127+
<string name="stream_compose_message_attachment_open">"Abrir archivo adjunto"</string>
127128
<string name="stream_compose_message_reactions_show">"Mostrar reacciones"</string>
128129
<string name="stream_compose_message_list_auto_translated">"Traducido"</string>
129130
<string name="stream_compose_message_list_empty_messages">"Sin mensajes"</string>

stream-chat-android-compose/src/main/res/values-fr/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
<string name="stream_compose_message_deleted_preview">"Message supprimé"</string>
125125
<string name="stream_compose_message_item_open_thread">"Ouvrir le fil"</string>
126126
<string name="stream_compose_message_item_options">"Afficher les options du message"</string>
127+
<string name="stream_compose_message_attachment_open">"Ouvrir la pièce jointe"</string>
127128
<string name="stream_compose_message_reactions_show">"Afficher les réactions"</string>
128129
<string name="stream_compose_message_list_auto_translated">"Traduit"</string>
129130
<string name="stream_compose_message_list_empty_messages">"Aucun message"</string>

stream-chat-android-compose/src/main/res/values-hi/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
<string name="stream_compose_message_deleted_preview">"मैसेज हटा दिया गया"</string>
185185
<string name="stream_compose_message_item_open_thread">"थ्रेड खोलें"</string>
186186
<string name="stream_compose_message_item_options">"संदेश के विकल्प दिखाएँ"</string>
187+
<string name="stream_compose_message_attachment_open">"अटैचमेंट खोलें"</string>
187188
<string name="stream_compose_message_reactions_show">"प्रतिक्रियाएँ दिखाएँ"</string>
188189
<string name="stream_compose_message_list_auto_translated">"अनुवादित"</string>
189190
<string name="stream_compose_message_list_empty_messages">"कोई मैसेज नहीं"</string>

stream-chat-android-compose/src/main/res/values-in/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
<string name="stream_compose_message_deleted_preview">"Pesan dihapus"</string>
125125
<string name="stream_compose_message_item_open_thread">"Buka utas"</string>
126126
<string name="stream_compose_message_item_options">"Tampilkan opsi pesan"</string>
127+
<string name="stream_compose_message_attachment_open">"Buka lampiran"</string>
127128
<string name="stream_compose_message_reactions_show">"Tampilkan reaksi"</string>
128129
<string name="stream_compose_message_list_auto_translated">"Diterjemahkan"</string>
129130
<string name="stream_compose_message_list_empty_messages">"Tidak ada pesan"</string>

stream-chat-android-compose/src/main/res/values-it/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
<string name="stream_compose_message_deleted_preview">"Messaggio cancellato"</string>
185185
<string name="stream_compose_message_item_open_thread">"Apri thread"</string>
186186
<string name="stream_compose_message_item_options">"Mostra opzioni messaggio"</string>
187+
<string name="stream_compose_message_attachment_open">"Apri allegato"</string>
187188
<string name="stream_compose_message_reactions_show">"Mostra reazioni"</string>
188189
<string name="stream_compose_message_list_auto_translated">"Tradotto"</string>
189190
<string name="stream_compose_message_list_empty_messages">"Nessun messaggio"</string>

stream-chat-android-compose/src/main/res/values-ja/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
<string name="stream_compose_message_deleted_preview">"メッセージは削除されました"</string>
137137
<string name="stream_compose_message_item_open_thread">"スレッドを開く"</string>
138138
<string name="stream_compose_message_item_options">"メッセージのオプションを表示"</string>
139+
<string name="stream_compose_message_attachment_open">"添付ファイルを開く"</string>
139140
<string name="stream_compose_message_reactions_show">"リアクションを表示"</string>
140141
<string name="stream_compose_message_list_auto_translated">"翻訳済み"</string>
141142
<string name="stream_compose_message_list_empty_messages">"メッセージはありません"</string>

stream-chat-android-compose/src/main/res/values-ko/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
<string name="stream_compose_message_deleted_preview">"메시지가 삭제되었습니다"</string>
137137
<string name="stream_compose_message_item_open_thread">"스레드 열기"</string>
138138
<string name="stream_compose_message_item_options">"메시지 옵션 표시"</string>
139+
<string name="stream_compose_message_attachment_open">"첨부파일 열기"</string>
139140
<string name="stream_compose_message_reactions_show">"반응 보기"</string>
140141
<string name="stream_compose_message_list_auto_translated">"번역됨"</string>
141142
<string name="stream_compose_message_list_empty_messages">"메시지 없음"</string>

0 commit comments

Comments
 (0)