-
-
Notifications
You must be signed in to change notification settings - Fork 60
Improve accessibility of checkbox. #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
| onCheckedChange = null, | ||
| modifier = modifier.semantics { | ||
| role = Checkbox | ||
| stateDescription = if (checked) "Checked" else "Unchecked" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do you want strings to be maintained in the project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can depend on the string from the material component, or mimic that one, as I would hope that they handle it properly already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. Ultimately it would be patched there to not depend on the handler being set.
@Composable
fun Checkbox(
checked: Boolean,
onCheckedChange: ((Boolean) -> Unit)?,
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource? = null,
colors: CheckboxColors = CheckboxDefaults.colors(),
) {
TriStateCheckbox(
state = ToggleableState(checked),
onClick =
if (onCheckedChange != null) {
{ onCheckedChange(!checked) }
} else null,
interactionSource = interactionSource,
enabled = enabled,
colors = colors,
modifier = modifier,
)
}it may only be necessary to pass an empty lambda to onCheckedChange |
|
Thanks, I will try that out. |
bc38efd to
651c537
Compare
|
⏸️ I won't be able to work on this within this month. |
+ Add missing Checkbox role which is only set if onClick is set. + Add state description to output the checked state via TalkBack. Relates mikepenz#453, mikepenz#417, mikepenz#318
651c537 to
a81d0e7
Compare
|
I rebased the branch and check the rendering and TalkBack output again. Now it looks fine - to layout issue anymore. Hence, ready for review. |

onClickis set.Relates #453, #417, #318