Let integrators supply channel header click labels for TalkBack#6447
Conversation
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
WalkthroughThis PR adds semantic accessibility labels to channel header interactive elements and refactors the sample app's main activity. ChannelHeader and ChannelScreen now accept optional ChangesChannel Header Accessibility Enhancements
Sample App Activity Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
SDK Size Comparison 📏
|
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
0099600 to
bee3a49
Compare
bee3a49 to
c8c8b78
Compare
Extract each preview body into an internal helper so the ChannelHeaderTest can drive snapshots from the same composables that back the @Preview annotations, mirroring the pattern used in ChannelMediaAttachmentsScreen. Moves the test next to its source under ui.messages.header, adds a thread-mode preview, and adds a few-members preview to keep member-count coverage that the old test had with channelWithFewMembers. Drops the user-typing preview/test: typing is rendered as a MessageListTypingIndicatorItemContent in the message list since PR #6206, so the header's typingUsers parameter no longer produces a visible change.
|



Goal
Give TalkBack a concrete verb when the user focuses the channel header trailing avatar or the title section, instead of the generic "double-tap to activate" hint. Because the click actions are integrator-defined, the SDK exposes the labels as paired parameters and ships no default label of its own — the action's owner also owns the label.
Implementation
SDK plumbing. Every layer that already exposes
onChannelAvatarClick/onHeaderTitleClicknow exposes a pairedonChannelAvatarClickLabel/onHeaderTitleClickLabel: String? = null:ChannelScreen(public): new defaulted params, threaded intoDefaultTopBarContent.ChannelHeaderParams(factory): new defaulted fieldsonHeaderTitleClickLabel,onChannelAvatarClickLabel.ChannelHeader(public): new defaulted params, threaded into the trailing- and center-content params.ChannelHeaderCenterContentParams.onClickLabel,ChannelHeaderTrailingContentParams.onClickLabel: new defaulted fields (additive — non-breaking for Compose data-class consumers).DefaultChannelHeaderTrailingContentandDefaultChannelHeaderCenterContent: pass the supplied label straight toModifier.clickable(onClickLabel = …, role = Role.Button). When the integrator doesn't supply one,nullflows through and TalkBack falls back to its generic verb hint.No SDK default label. The SDK doesn't know what the integrator's callback actually does (open settings? show a sheet? something else?), so it must not hard-code a label like "Open conversation info". The integrator owns both the action and its announced verb.
Sample app demonstrates the integrator side.
ChannelActivity(the renamed sample messages screen) passesonChannelAvatarClickLabel = stringResource(R.string.messages_open_channel_info)alongside::openChannelInfo, with the label defined in the sample's ownstrings.xml.Sample refactor. While in this file,
MessagesActivityis renamed toChannelActivityand moved to thesample/ui/channelpackage (alongsideDirectChannelInfoActivityandGroupChannelInfoActivity). All callers (AndroidManifest,ChannelsActivity,StartupActivity, channel info / drafts / reminders / add-channel activities) are updated.Public API: additive trailing-defaulted params on
ChannelScreen,ChannelHeader,ChannelHeaderParams,ChannelHeaderCenterContentParams,ChannelHeaderTrailingContentParams. API dump regenerated.Note: the scanner also flagged the avatar's 40 dp touch-target height. Deliberately not addressed here — any layout-level expansion either resizes the avatar (visual change) or shifts the centered title text. To be revisited separately.
Testing
Enable TalkBack on a physical device, run the sample.
messages_open_channel_infostring, demonstrating the integrator-supplied label.MessagesActivity/ChannelActivitydoesn't wireonHeaderTitleClickin the sample (the SDK doesn't make assumptions on its behalf). TalkBack reads only the title text. If a future sample integration wiresonHeaderTitleClick, the matchingonHeaderTitleClickLabelis exposed and ready to use.onChannelAvatarClick = { doSomethingElse() }withoutonChannelAvatarClickLabel. Confirm TalkBack falls back to the generic "double-tap to activate" hint — the SDK doesn't announce a misleading default.)Summary by CodeRabbit
New Features
Refactor