Fix accessibility: announce checked/unchecked state for invite user rows (#6407)

Replace clickable(role = Role.Checkbox) with toggleable(value = checked, role =
Role.Checkbox) so TalkBack can announce the current state and state changes.
Set the inner Checkbox.onCheckedChange = null to make it a purely visual
indicator, avoiding duplicate accessibility focus on the same control.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benoit Marty
2026-07-01 17:51:12 +02:00
parent 58b3830187
commit 26e4e895a9
@@ -8,12 +8,12 @@
package io.element.android.libraries.matrix.ui.components
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.selection.toggleable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Alignment
@@ -39,8 +39,8 @@ fun CheckableUserRow(
Row(
modifier = modifier
.fillMaxWidth()
.clickable(role = Role.Checkbox, enabled = enabled) {
onCheckedChange(!checked)
.toggleable(value = checked, role = Role.Checkbox, enabled = enabled) {
onCheckedChange(it)
},
verticalAlignment = Alignment.CenterVertically,
) {
@@ -65,7 +65,7 @@ fun CheckableUserRow(
}
}
Checkbox(
onCheckedChange = onCheckedChange,
onCheckedChange = null,
checked = checked,
enabled = enabled,
)