Inactive Accessible View
This is an experimental rule, and therefore its result(s) are considered to be in beta testing. Learn more about experimental rules and how you can help improve them.
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.
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 {
//Remove the below API to make it accessible
invisibleToUser()
}
) {
Text("Click here")
}
FloatingActionButton(onClick = { }) {
Image(
painter = painterResource(id = R.drawable.floating_button),
contentDescription = "floating button",
Modifier.semantics {
//Remove the below API to make it accessible
invisibleToUser()
}
)
}