Commit c2a34f7
authored
Improve message composer TalkBack accessibility: action verbs, banner merge, audio recording lifecycle (#6441)
* Add action verbs to composer Send / Save / attach buttons
`MessageComposerSendButton`, `MessageComposerSaveButton`, and the
attachments toggle in `MessageComposerLeadingContent` are wrapped in
Material3 `FilledIconButton`, which does not expose an `onClickLabel`.
TalkBack therefore announced each as `"<icon label>, button, double-tap
to activate"` — the generic activate hint had no verb.
Layer a `Modifier.semantics { onClick(label = …) { …; true } }` on each
button so TalkBack reads a concrete action:
- Send → `"Send message"` (`stream_compose_message_composer_send_action`).
- Save → `"Save changes"` (`stream_compose_message_composer_save_action`).
- Attachments → state-aware label that pairs with the existing
`stateDescription`: `"Open attachments"` when collapsed,
`"Close attachments"` when expanded
(`stream_compose_message_composer_attachments_open` /
`…_close`).
The semantics action call-through (`onClick(); true`) keeps the actual
click handler intact while overriding only the announced verb. The
attachments toggle button is also extracted into a private
`AttachmentPickerButton` composable to keep
`MessageComposerLeadingContent` under detekt's method-length cap.
Translates the four new strings across all 7 supported locales. No
public API surface change.
* Merge composer edit/reply banner for a11y
Wraps the edit-indicator row and the reply quoted-message in
`Modifier.semantics(mergeDescendants = true) {}` so TalkBack reads the
banner as a single chunk instead of fragment by fragment. Cancel icons
now announce the action being cancelled ("Cancel editing" / "Cancel
reply") rather than the generic "Cancel".
When replying to your own message, the username Text leaf overrides
`contentDescription` to "Reply to you" so TalkBack mirrors the
"Reply to {name}" symmetry while the visible "You" label stays compact.
* Improve composer audio recording accessibility
Mic button content description includes the press-and-hold gesture
hint and exposes Role.Button, so TalkBack reads "Record audio message.
Press and hold to record. Button." without a misleading "double-tap
to activate" hint.
One-shot announcements via View.announceForAccessibility on recording
state transitions:
- Idle → Hold: "Recording started. Slide left to cancel, up to lock."
- non-Idle → Idle: "Recording cancelled", gated on a cancelRequested
flag set by wrapped onCancelRecording / onDeleteRecording. Confirm
and send paths leave the flag unset so they stay silent and let the
attachment item announce itself.
Focus moves on state transitions:
- Hold → Locked: focus on the merged recording-bar row.
- Locked → Overview: focus on the merged playback row. Overview's
outer Row is split into a separately-focusable play button + an
inner focusable summary so the play action stays reachable.
- A 100ms delay before requestFocus gives Compose layout and the
accessibility tree time to settle, beating TalkBack's fallback
recovery from the previously-focused node.
Cancel and Delete focus is left to Compose's natural recovery — focus
returns to the mic button when it becomes visible again.
* Consume recording-transition flag only on announce
Move `onTransitionConsumed()` inside the announcement branches so the
caller's `cancelRequested` flag only clears when an announcement has
actually fired. The bug described in the review doesn't manifest with
the current state writers (the wrapped `onCancelRecording` /
`onDeleteRecording` set the flag and `setState(Idle)` in the same
Compose snapshot) but separating "transition observed" from "transition
consumed" tightens the helper's contract and makes it robust to future
changes to the flag writers or the `LaunchedEffect` keys.
* Label audio attachment play / pause button
* Let integrators supply composer click labels1 parent b888d8f commit c2a34f7
21 files changed
Lines changed: 579 additions & 144 deletions
File tree
- stream-chat-android-compose
- api
- src/main
- java/io/getstream/chat/android/compose/ui
- attachments/content
- components
- composer
- messages
- messages/composer
- internal
- theme
- res
- values-es
- values-fr
- values-hi
- values-in
- values-it
- values-ja
- values-ko
- values
Lines changed: 62 additions & 40 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
286 | 294 | | |
287 | 295 | | |
288 | 296 | | |
| |||
293 | 301 | | |
294 | 302 | | |
295 | 303 | | |
296 | | - | |
| 304 | + | |
297 | 305 | | |
298 | 306 | | |
299 | 307 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| 95 | + | |
| 96 | + | |
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
| |||
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| 173 | + | |
| 174 | + | |
169 | 175 | | |
170 | 176 | | |
171 | 177 | | |
| |||
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
143 | 147 | | |
144 | 148 | | |
145 | 149 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
150 | 159 | | |
151 | | - | |
| 160 | + | |
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
155 | 169 | | |
156 | 170 | | |
157 | 171 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
93 | 95 | | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| |||
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| 118 | + | |
| 119 | + | |
115 | 120 | | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| |||
195 | 201 | | |
196 | 202 | | |
197 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
198 | 207 | | |
199 | 208 | | |
200 | 209 | | |
| |||
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| 227 | + | |
| 228 | + | |
218 | 229 | | |
219 | 230 | | |
220 | 231 | | |
| 232 | + | |
221 | 233 | | |
222 | 234 | | |
223 | 235 | | |
| |||
236 | 248 | | |
237 | 249 | | |
238 | 250 | | |
| 251 | + | |
| 252 | + | |
239 | 253 | | |
240 | 254 | | |
241 | 255 | | |
| 256 | + | |
242 | 257 | | |
243 | 258 | | |
244 | 259 | | |
| |||
263 | 278 | | |
264 | 279 | | |
265 | 280 | | |
| 281 | + | |
| 282 | + | |
266 | 283 | | |
267 | 284 | | |
268 | 285 | | |
| |||
318 | 335 | | |
319 | 336 | | |
320 | 337 | | |
| 338 | + | |
321 | 339 | | |
322 | 340 | | |
323 | 341 | | |
| |||
Lines changed: 101 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
118 | 116 | | |
119 | 117 | | |
120 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
121 | 139 | | |
122 | 140 | | |
123 | 141 | | |
124 | 142 | | |
125 | | - | |
| 143 | + | |
126 | 144 | | |
127 | 145 | | |
128 | 146 | | |
| |||
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
134 | | - | |
| 152 | + | |
135 | 153 | | |
136 | 154 | | |
137 | 155 | | |
| |||
310 | 328 | | |
311 | 329 | | |
312 | 330 | | |
313 | | - | |
314 | | - | |
315 | 331 | | |
316 | 332 | | |
317 | 333 | | |
318 | 334 | | |
319 | | - | |
| 335 | + | |
320 | 336 | | |
321 | 337 | | |
322 | 338 | | |
| |||
0 commit comments