Repository navigation
Conversation
A clickable ListItem used `Modifier.clickable` without a role, so screen readers only announced a generic "Double tap to activate" hint. Set `Role.Button` on the clickable, except when the item contains a Checkbox, Switch or RadioButton, whose role is already provided by the toggleable / selectable modifier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These ListItems were made clickable with `Modifier.clickable`, bypassing the ListItem `onClick` parameter, so they were not exposed as buttons to accessibility services. Use `onClick` in the avatar action, attachment source, message action and room list context menu bottom sheets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
jmartinesp
left a comment
There was a problem hiding this comment.
I think I found a possible issue. Also, a suggestion, although I'm not sure how feasible it is.
| .clickable(enabled = enabled || alwaysClickable, onClick = onClick) | ||
| .clickable( | ||
| enabled = enabled || alwaysClickable, | ||
| role = (trailingContent ?: leadingContent).clickableRole(), |
There was a problem hiding this comment.
I think this is wrong. If you have a list items with a leading content that's a checkbox and a trailing one that's an icon, the icon one will take precedence and you'll get a Button role. Maybe adding some extra tests for these cases would help?
There was a problem hiding this comment.
Yes, there is no occurrence in the code, but good catch since this can happen in the future. I have updated the code
| .clickable( | ||
| enabled = enabled || alwaysClickable, | ||
| role = (trailingContent ?: leadingContent).clickableRole(), | ||
| onClick = onClick, | ||
| ) |
There was a problem hiding this comment.
Not new, but couldn't we merge this with withAccessibilityModifier, maybe?
There was a problem hiding this comment.
Done, also I have renamed the method now that is handle the onClick parameter.
The role was computed from `trailingContent ?: leadingContent`, so a list item with a leading Checkbox or RadioButton and a trailing Icon was exposed as a button, without its checked or selected state. Look for a Checkbox, Switch or RadioButton in the trailing content then in the leading content, and merge the clickable modifier into `withAccessibilityModifier` so that the item only has one click modifier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The function now also makes the list item clickable, so the old name was misleading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jmartinesp
left a comment
There was a problem hiding this comment.
Thanks for the changes. I'm approving, with a couple of nits:
alwaysClickableis ignored when the row's control is disabled: with a disabled switch, checkbox or radio button, tapping does nothing even withalwaysClickable = true, which contradicts its docs. That said, I don't think any existing code uses this.- Controls on non-clickable rows
with onClick = null, a switch, checkbox or radio button row still gets an enabled toggle. TalkBack says "double tap to toggle", and double-tapping does nothing. This was already the case before, but it would be nice to fix it.
A list item with `alwaysClickable = true` was not clickable when its Checkbox, Switch or RadioButton was disabled, contrary to the documentation of the parameter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A list item with a Checkbox, Switch or RadioButton and no `onClick` still had an enabled toggleable or selectable modifier, so TalkBack announced "Double tap to toggle" although nothing happened. Only expose the role and the state of the control in this case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Content
ListItemwithonClicknow exposesRole.Button(except when it contains a Checkbox, Switch or RadioButton, which already expose their own role).Modifier.clickablenow useonClick: avatar actions, attachment sources, message actions and room list context menu.Motivation and context
Part of #8291 (finding 4.4, room list context menu) and #8292 (avatar action sheet; the avatar picker itself is handled in #8318).
Screen readers only announced a generic hint on these items, without a role.
Screenshots / GIFs
No visual change.
Tests
ListItemTestfor the roles.Tested devices
Checklist
/code-reviewrun in a fresh session) before requesting a human review.🤖 Generated with Claude Code