# Accessibility Tests in Compose - Name, Role, Value

DevFeed: [Accessibility Tests in Compose - Name, Role, Value](<https://devfeed.tech/articles/accessibility-tests-in-compose-name-role-value-38482.md>)

Original publisher: [Read original article](<https://eevis.codes/blog/2024-06-03/accessibility-tests-in-compose-name-role-value/>)

Author: Eevis Panula

Published: 2024-06-19T03:57:03.684000Z

Content type: tutorial

Language: en

Sources: [Eevis Blog](<https://devfeed.tech/sources/eevis-blog.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Accessibility](<https://devfeed.tech/topics/accessibility.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Web Content Accessibility Guidelines](<https://devfeed.tech/topics/web-content-accessibility-guidelines.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>)

Tags: [accessibility](<https://devfeed.tech/tags/accessibility.md>), [accessibility-guidelines](<https://devfeed.tech/tags/accessibility-guidelines.md>), [compose](<https://devfeed.tech/tags/compose.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [tests](<https://devfeed.tech/tags/tests.md>), [wcag](<https://devfeed.tech/tags/wcag.md>), [web-content-accessibility-guidelines](<https://devfeed.tech/tags/web-content-accessibility-guidelines.md>)

## AI overview

A tutorial on testing accessibility in Jetpack Compose. It explains how to verify the accessible name, role, and value of custom components, including a switch, radio button group, and clickable row, in relation to the WCAG "Name, Role, Value" criterion.

## Source excerpt

When writing tests for your app, you should also consider testing for accessibility-related things. And I get it; it can be challenging to know where to start. So, I decided to write this blog post about how to test some accessibility aspects. In this post, we will add some accessibility-related tests for three custom components constructed with the help of clickable, selectable, and toggleable modifiers. These components were built in a blog post I wrote: Improving Android Accessibility with Modifiers in Jetpack Compose. What Are We Testing? The tests we're writing verify that the components have names, roles, and values. But where does this group come from? The background is that Web Content Accessibility Guidelines (WCAG) has a success criterion, "Name, Role, Value", which ensures that every element has a programmatically determinable name and role. Also, states, properties, and values that users can change are programmatically changeable. And now, if you wonder why I'm mentioning something named "Web," the WCAG is also used to determine the minimum level of accessibility for mobile apps as well, despite the name. Name, in this case, means the accessible name--so, the textual representation of the element. It can be, for example, a button's text, an icon button's content description, a label for a switch, or similar. It's what anyone using a screen reader hears. Voice access users use it to activate interactive elements. Role, on the other hand, is the role of the element. It can be, for example, a button - which tells the user that, hey, this is a button, and it should behave as a button. A role is a promise of how things should work, so if you add a role, be sure to add the correct interactions as well. However, roles are used less on Android than on the web. Value can refer to an element's state, property, or value. The exact thing is different per element. For example, with a checkbox, the value tells if it is checked, or with an accordion, it's the state that