Skip to content

Clean up TalkBack accessibility semantics#6498

Open
andremion wants to merge 5 commits into
developfrom
andrerego/and-1229-compose-sdk-accessibility-cleanup
Open

Clean up TalkBack accessibility semantics#6498
andremion wants to merge 5 commits into
developfrom
andrerego/and-1229-compose-sdk-accessibility-cleanup

Conversation

@andremion

@andremion andremion commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Goal

The TalkBack sweep (AND-1180) left the Compose SDK's accessibility code uneven: a few parent-level overrides re-derive what their children already announce, and some empty merge-semantics blocks add noise. This consolidates the remaining cleanup into one pass, and folds in the verified media-grid traversal change and the QA reorder feedback on the Giphy preview, so we stop opening a PR per finding.

Implementation

Four independent changes, one per commit:

  • AudioRecordingContent (locked + overview rows): the parent contentDescription under mergeDescendants concatenated with the child descriptions (duration, progress), so any new child silently shifted the announce. The label now lives on a child leaf (the leading icon, the waveform) and the merge stays only as the single TalkBack focus stop.
  • Empty merge-semantics blocks: removed the empty Modifier.semantics(mergeDescendants = true) {} on Rows that already have a clickable or toggleable (the merge boundary is implicit there), and kept plus commented the load-bearing ones (containers with no click handler, such as the deleted-message fallback).
  • Giphy preview: the focused ephemeral preview announced "Only visible to you, [alt text], Giphy". It now announces as one node leading with "Giphy preview", then the alt text, then "Only visible to you" (composed via clearAndSetSemantics). Added the stream_compose_giphy_preview_label string in all supported locales.
  • Media attachment grid: added isTraversalGroup so a TalkBack swipe walks every tile in order before leaving the grid.

No public API change (apiCheck passes). The changes are semantics and string only.

Testing

Manual TalkBack testing on a device or emulator:

  1. Giphy preview: open a channel and send a /giphy <query> command. With TalkBack on, focus the rendered preview. It should read as a single stop: "Giphy preview, [search query / alt text], Only visible to you" (leading with "Giphy preview"). Verified on-device: the merged accessibility node exposes contentDescription="Giphy preview, <query>, Only visible to you".
  2. Voice recording: start a voice recording in the composer and lock it, then stop to reach the overview. With TalkBack, the locked and overview rows each read as a single stop with the recording label plus duration (plus progress for the locked state).
  3. Media grid: open a message with multiple image attachments. With TalkBack, once focus enters the grid, swiping walks every tile in order before moving past the grid.
  4. Poll switches, poll dialogs, quoted reply, deleted message: confirm each still reads as a single focus stop (no regression from the merge-block cleanup).

Summary by CodeRabbit

  • Improvements

    • Enhanced accessibility for media attachments, Giphy previews, polls, and audio recording with improved TalkBack descriptions and traversal behavior.
  • Localization

    • Added Giphy preview label translations across Spanish, French, Hindi, Indonesian, Italian, Japanese, and Korean locales.

The locked and overview rows set contentDescription on a mergeDescendants
container, which concatenates with the child descriptions (duration,
progress) so any new child silently shifts the announce. Move the label
onto a child leaf (the leading icon and the waveform) so the announce is
composed from the children in visual order, and keep the merge only as the
single TalkBack focus stop.
Remove the empty Modifier.semantics(mergeDescendants = true) {} blocks on
Rows that already have a clickable or toggleable, where the merge boundary
is implicit. Keep the load-bearing ones (containers with no click handler)
and add a short comment explaining that they group their children into a
single TalkBack focus stop.
The focused ephemeral Giphy preview announced "Only visible to you, [alt
text], Giphy". Compose a single description that leads with "Giphy
preview", then the alt text, then "Only visible to you", and apply it via
clearAndSetSemantics so the merged stop reads in that order. Add the
stream_compose_giphy_preview_label string in all supported locales.
Add isTraversalGroup to the multi-image grid container so that once focus
is inside the grid, a swipe walks every tile in order before leaving,
instead of letting the surrounding list pull focus across rows mid-grid.
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@andremion andremion added the pr:improvement Improvement label Jun 11, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.88 MB 5.88 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.11 MB 11.11 MB 0.00 MB 🟢
stream-chat-android-compose 12.53 MB 12.53 MB 0.00 MB 🟢

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR refactors TalkBack accessibility semantics across the Stream Chat Compose UI library. Changes include composing Giphy preview descriptions from multiple text sources, enabling grid traversal grouping for media attachments, relocating content descriptions from parent to leaf components in audio recording, removing redundant semantics modifiers from toggleable/clickable elements, and documenting accessibility intent throughout the codebase with clarifying comments.

Changes

TalkBack Accessibility Semantics

Layer / File(s) Summary
Giphy preview composed descriptions and localization
src/main/java/io/getstream/chat/android/compose/ui/components/messages/GiphyMessageContent.kt, src/main/res/values*/strings.xml
Giphy preview builds a composed TalkBack description by combining "Giphy preview" label, giphy alt/title (if present), and "only visible to you" text via clearAndSetSemantics. New stream_compose_giphy_preview_label string resource added in nine languages.
Media attachment grid traversal grouping
src/main/java/io/getstream/chat/android/compose/ui/attachments/content/MediaAttachmentContent.kt
Grid semantics now explicitly set isTraversalGroup = true to keep attachment grid tiles together during TalkBack traversal as a grouped unit.
Audio recording content description leaf ownership
src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/AudioRecordingContent.kt
Content descriptions relocated from parent semantics to leaf components: locked-recording rowLabel moves to leading voice icon, overview playback rowLabel moves to waveform slider. Parent semantics now only merge descendants.
Toggleable/clickable element semantics cleanup
src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt, src/main/java/io/getstream/chat/android/compose/ui/messages/header/ChannelHeader.kt
Redundant merge-descendants semantics removed from toggleable switches and clickable header title, allowing modifiers to manage their own semantics without no-op overrides.
Accessibility intent documentation
src/main/java/io/getstream/chat/android/compose/ui/components/messages/QuotedMessage.kt, src/main/java/io/getstream/chat/android/compose/ui/components/poll/*.kt, src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/MessageComposerEditIndicator.kt, src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt
Clarifying comments document accessibility design across quoted messages, poll components, and message containers: noting absence of click handlers and intent to merge component announcements into single TalkBack stops.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • gpunto
  • VelikovPetar

🐰 Accessibility hops to new heights,
Grid tiles grouped, descriptions bright,
TalkBack traversals smooth and sound,
Leaf nodes own their text profound,
Semantics merged, intent declared clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description thoroughly covers all required sections: goal, implementation (four independent changes with detailed explanations), testing (manual TalkBack testing with specific steps), and addresses API compatibility.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title directly describes the main objective of the PR—accessibility semantics cleanup for TalkBack—which is comprehensively addressed across all file changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch andrerego/and-1229-compose-sdk-accessibility-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@andremion andremion changed the title compose: Clean up TalkBack accessibility semantics Clean up TalkBack accessibility semantics Jun 11, 2026
@andremion andremion marked this pull request as ready for review June 11, 2026 14:02
@andremion andremion requested a review from a team as a code owner June 11, 2026 14:02

@gpunto gpunto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, just one question

MessageGiphyContent composes and owns the focused preview's merged
TalkBack description and clears the inner GiphyAttachmentContent
semantics. Note in the KDoc that customizing the preview's accessibility
announcement should override MessageGiphyContent rather than
GiphyAttachmentContent.
@andremion andremion enabled auto-merge (squash) June 11, 2026 15:15
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants