Inactive Accessible View
Clickable Compose views should include text and or a content description. They should also be accessibility focusable.
Supported within:
Impact
Issues found by this rule impact anyone using assistive technology. Inability to interact with control while using assistive technology (AT) when the same control can be interacted without AT is an issue.
note
The version of Android, device, and manufacturer may play a part in issue detection.
Confirmation
- Turn on TalkBack or SwitchAccess
- One of the following will happen:
- Inaccessible: The view is unable to be focused and or interacted with.
- Accessible: The view is focused and available to interact with.
How to Fix
Avoid marking tappable Compose views with meaningful information as invisibleToUser
. Views that people can access without assistive technology should be available for those using assistive technology.
In both examples below, remove invisibleToUser
to ensure views are available to people using assistive technology.
Button(onClick = { },
modifier = Modifier.semantics {
invisibleToUser()
}
) {
Text("Click here")
}
FloatingActionButton(onClick = { }) {
Image(
painter = painterResource(id = R.drawable.floating_button),
contentDescription = "floating button",
Modifier.semantics { invisibleToUser() }
)
}