For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

Interactive Role Undefined

Interactive Android elements must expose a meaningful accessibility role so TalkBack can announce what the element is and how to interact with it.

WCAG Reference

Maps to: WCAG 4.1.2 Name, Role, Value | Applies to: WCAG 2.0, WCAG 2.1, WCAG 2.2 Introduced in: WCAG 2.0 | Level: A | Read the official specification →

What this rule checks​

The scanner flags interactive elements (buttons, switches, checkboxes, sliders) that do not expose a recognized accessibility role to the Android accessibility framework.

Why it matters​

TalkBack announces both the accessible name and the role ("Button", "Switch", "Checkbox") to tell users what kind of control they are interacting with. Without a role, users hear the name but cannot tell whether to tap, swipe, or double-tap.

Common failure patterns​

  • custom clickable View elements with no accessibilityClassName override
  • LinearLayout or FrameLayout used as a button with an onClickListener but no role
  • Jetpack Compose elements using clickable without a role parameter in Modifier.semantics

Remediation guidance​

  • use native Android widgets (Button, Switch, CheckBox) whenever possible
  • for custom views, override getAccessibilityClassName() to return the appropriate widget class name
  • in Jetpack Compose, set role = Role.Button (or the appropriate role) inside Modifier.semantics { }
  • test with TalkBack to confirm the announced role matches the element's behavior

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles