Improve poll creation TalkBack accessibility: action verb, toggle rows, error live region, reorder actions#6445
Conversation
StreamButton's clickable was set with no onClickLabel, so TalkBack defaulted to the generic "double-tap to activate" hint. Add an optional `onClickLabel` parameter to StreamButton and pass it through to clickable. PollCreationHeader's create button now provides "create poll" as the verb, so TalkBack reads "Create Poll, button. Double-tap to create poll." instead of the generic hint.
Each switch row in `PollSwitchList` (top-level options and the inner
limit-votes row) wraps a title, description and a `StreamSwitch` —
TalkBack focused each as its own node, so a user had to swipe three
times to learn what one switch controlled. Wrap each row in
`Modifier.toggleable(role = Role.Switch) + semantics(mergeDescendants
= true) {}` so the row becomes a single focus stop announced as
"{title}, {description}, switch, on/off", with the row's onValueChange
firing on tap or double-tap. The inner `StreamSwitch` now takes
`onCheckedChange = null` (the pattern its KDoc already documents),
which makes the visual switch decorative while the parent row owns
the toggle action. Sighted users also gain a larger hit target.
`PollOptionErrorRow` mounts conditionally when an option has an error
(currently only the duplicate-title case). Sighted users see the icon
and message appear inline; TalkBack users had no signal until they
swiped to the row. Add `Modifier.semantics(mergeDescendants = true)
{ liveRegion = LiveRegionMode.Polite }` so TalkBack announces the
existing error message the moment the row enters the tree.
The reorder UX relies on dragging a handle, which isn't a gesture
TalkBack supports natively. Expose two `CustomAccessibilityAction`s
("Move up" / "Move down") on each option's drag handle so TalkBack
users can reorder via the local context menu. Each action is wired to
a shared `move` lambda used by both the gesture's `onSettle` callback
and the new accessibility actions, and the action list is built per
row so the top option doesn't offer Move up and the bottom option
doesn't offer Move down.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
WalkthroughAdds accessibility labels and actions to poll UI and StreamButton, centralizes poll item move logic and toggle handling, updates localized poll strings, and regenerates Compose lambda accessors in the public API surface. ChangesPoll UI and Button Accessibility Enhancements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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. |
gpunto
left a comment
There was a problem hiding this comment.
Looks good, just a suggestion
|



AND-1180
Goal
Bring the Compose poll creation screen to a usable TalkBack baseline.
Implementation
StreamButtonaccepts anonClickLabel; the poll header passes "create poll". TalkBack reads the verb instead of the generic hint.toggleablewith merged semantics; innerStreamSwitchis non-interactive and the row owns the 48 dp touch target viadefaultMinSize. TalkBack reads label + state.PollOptionErrorRowusesliveRegion = Politeso the duplicate-title error is announced as it mounts.CustomAccessibilityActions. Drag-settle and a11y action share one move lambda.New strings:
stream_compose_poll_create_action,stream_compose_poll_option_move_up,stream_compose_poll_option_move_down.stream_compose_poll_option_reorderand_removetake the option name as%s. Translated in 7 locales.Public API: additive
onClickLabel: String? = nullonStreamButton(internal).Testing
Enable TalkBack on a physical device. Open the Compose sample, start a new channel, tap the attachments picker, select Polls.
Summary by CodeRabbit
New Features
Accessibility
Localization