Compose Accessibility Tests
Adds automatic accessibility checks to Jetpack Compose UI tests, so broken contrast or labels fail the build.
Claude's review
8/10 Precise Compose accessibility-check API with cited line numbers, edge cases and right/wrong patterns.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Use this skill to enable Espresso's `AccessibilityValidator` against the Compose semantics tree via `enableAccessibilityChecks(...)` from `androidx.compose.ui:ui-test-accessibility` (for `ComposeUiTest`) or `androidx.compose.ui:ui-test-junit4-accessibility` (for `ComposeTestRule` / `AndroidComposeTestRule`). Covers the API surface, the auto-check after every UI-mutating action (`performMultiModalInput` is the lone exception), the manual `tryPerformAccessibilityChecks()` entry point, sharing the validator with Espresso via `AccessibilityChecks.enable()`, the API 34+ requirement, and the Robolectric inconclusive behavior (logs a `Log.w` warning and still installs the validator, but Robolectric does not faithfully drive accessibility services — b/332778271). Use when the developer asks "how do I enable a11y checks in a Compose test", "AccessibilityChecks.enable", "AccessibilityValidator throws on click", "robolectric a11y not supported", or "ComposeTestRule IllegalStateException".
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: enabling-accessibility-checks
description: Use this skill to enable Espresso's `AccessibilityValidator` against the Compose semantics tree via `enableAccessibilityChecks(...)` from `androidx.compose.ui:ui-test-accessibility` (for `ComposeUiTest`) or `androidx.compose.ui:ui-test-junit4-accessibility` (for `ComposeTestRule` / `AndroidComposeTestRule`). Covers the API surface, the auto-check after every UI-mutating action (`performMultiModalInput` is the lone exception), the manual `tryPerformAccessibilityChecks()` entry point, sharing the validator with Espresso via `AccessibilityChecks.enable()`, the API 34+ requirement, and the Robolectric inconclusive behavior (logs a `Log.w` warning and still installs the validator, but Robolectric does not faithfully drive accessibility services — b/332778271). Use when the developer asks "how do I enable a11y checks in a Compose test", "AccessibilityChecks.enable", "AccessibilityValidator throws on click", "robolectric a11y not supported", or "ComposeTestRule IllegalStateException".
license: Apache-2.0. See LICENSE for complete terms.
metadata:
author: Jaewoong Eum (skydoves)
keywords:
- jetpack-compose
- ui-testing
- accessibility
- enableAccessibilityChecks
- AccessibilityValidator
- tryPerformAccessibilityChecks
- api-34
- robolectric
- espresso-a11y-interop
---
# Enabling Accessibility Checks — Espresso's `AccessibilityValidator` on the Compose Tree
The Compose accessibility test artifacts wire Espresso's `AccessibilityValidator` (from `com.google.android.apps.common.testing.accessibility.framework.integrations.espresso`) into the Compose action pipeline. Once enabled, every action that mutates the UI (`performClick`, `performScrollTo*`, `performTextInput`, …) runs the validator against the underlying View first. Two distinct artifacts cover two test entry points (`ComposeUiTest` and `ComposeTestRule`), with one stable and one experimental. Real device + API 34+ for meaningful results — on Robolectric the validator is still installed but a `Log.w` warning is emitted and any pass is inconclusive (Robolectric does not faithfully drive the accessibility services).
## When to use this skill
- The developer is adding accessibility regression coverage to a Compose-only screen.
- A reviewer asks for an a11y test that fails the build when contrast / touch-target / label rules regress.
- The developer mentions "AccessibilityChecks.enable", "AccessibilityValidator", or "Compose accessibility validator".
- A hybrid Compose + Views screen needs a single shared `AccessibilityValidator` between Espresso and Compose.
- The developer's a11y check appears to do nothing on Robolectric (the `Log.w` warning explains why).
## When NOT to use this skill
- The check fails because of a bad finder, not an a11y violation. Use `../printing-the-semantics-tree/SKILL.md`.
- The test runs on Robolectric (host JVM). Cited limitation at `compose/ui/ui-test-accessibility/src/androidMain/kotlin/androidx/compose/ui/test/accessibility/ComposeUiTestExt.android.kt:50-53`. Move the test to `androidDeviceTest` and a real device API 34+ — see `../../setup/setting-up-host-vs-device-tests/SKILL.md`.
- The test target API is below 34. The annotation `@RequiresApi(34)` makes calls fail to compile on lower minSdk. Use `@SdkSuppress(minSdkVersion = 34)` on the test method and skip on older devices.
- The user wants semantics test coverage (roles, content descriptions, click actions). Use `../../assertions/asserting-node-state-and-text/SKILL.md`.
## Prerequisites
- Real Android device (or emulator) running API **34+** (Android U).
...From skydoves's repository, Apache-2.0 licence.
Related skills
-
Checked
Android Gradle Plugin upgrade
Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.
8/101 credit -
Checked
CocoaPods to SwiftPM
Moves Kotlin Multiplatform projects from CocoaPods to Swift Package Manager and updates the Xcode project.
8/101 credit -
Checked
Kotlin Native build speed
Diagnoses and fixes slow Kotlin/Native iOS builds in Kotlin Multiplatform projects, both locally and on CI.
7/101 credit -
Checked
SwiftUI Liquid Glass
Adds and reviews Liquid Glass in SwiftUI apps for iOS 26, avoiding pitfalls with bars, buttons and scrolling.
7/101 credit -
Checked
Native Mobile App Design
Designs Expo and React Native screens that feel truly native, with proper navigation, motion and dark mode.
7/101 credit -
Checked
Offline Android LLM apps
Builds an Android app that runs an open LLM on the phone with LiteRT, so it works without a server.
7/101 credit