Make radio rows fully tappable (label + dot), not just the dot
Build & Release APK / build (push) Successful in 12m53s
Build & Release APK / build (push) Successful in 12m53s
RadioGroup rows only responded to taps on the ~144px radio dot; tapping the label did nothing. Wrap each row in Modifier.selectable(role=RadioButton) with RadioButton(onClick=null) so the whole row is one accessible tap target. Verified on-device: tapping the 'Download only' label now selects it.
This commit is contained in:
@@ -5,6 +5,8 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.selection.selectable
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
@@ -382,10 +384,17 @@ private fun <T> RadioGroup(
|
||||
}
|
||||
options.forEach { option ->
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.selectable(
|
||||
selected = option == selected,
|
||||
role = Role.RadioButton,
|
||||
onClick = { onSelect(option) },
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
RadioButton(selected = option == selected, onClick = { onSelect(option) })
|
||||
// onClick = null: the whole row handles selection (bigger tap target + a11y).
|
||||
RadioButton(selected = option == selected, onClick = null)
|
||||
Text(itemLabel(option), style = MaterialTheme.typography.bodyMedium)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user