agentleFS
Community-AccessCommunity-Access/accessibility-agents/skills/kb-mobile-accessibility/SKILL.md

kb-mobile-accessibility

Skill458 starsChanged 33 days agoMITView on GitHub

Reference data, not a reviewer. Audit React Native, Expo, iOS, Android for accessibility. Review accessibilityLabel, accessibilityRole, accessibilityHint, touch targets (44x44pt min), screen reader support, and platform semantics.

  • Installs packages

The file

Files
SKILL.md

Mobile Accessibility Skill

This skill provides mobile accessibility reference data for React Native, Expo, iOS, and Android auditing. Used by the mobile-accessibility skill.


React Native Accessibility Props - Full Reference

Each prop, with its type, values or notes, WCAG SC and required. The aria-* props and role are aliases in current React Native (0.88); there is no aria-describedby or aria-role.

PropTypeValues / NotesWCAG SCRequired
accessiblebooleantrue marks the view as an accessibility node4.1.2Conditional
accessibilityLabelstringHuman-readable name - overrides all child text1.1.1, 4.1.2Yes (all interactive + image elements)
accessibilityLabelledBystring / string[]Android only - references the nativeID of the labelling element1.3.1For form inputs
accessibilityRolestring (see roles table)Communicates element type to AT4.1.2Yes (all interactive elements)
accessibilityHintstringAdditional context spoken after label + role3.3.2When action isn't obvious
accessibilityStateobject{checked, disabled, expanded, selected, busy}4.1.2State-bearing elements
accessibilityValueobject{min, max, now, text}4.1.2Sliders, steppers, progress bars
accessibilityActionsarray[{name, label}] - defines custom actions2.5.1, 4.1.2Context menus, long-press alternatives
onAccessibilityActionfunctionHandles custom action triggers2.5.1, 4.1.2Paired with accessibilityActions
accessibilityLiveRegionstringAndroid only - 'none' / 'polite' / 'assertive'4.1.3Dynamic content updates
accessibilityViewIsModalbooleaniOS only - VoiceOver ignores sibling views2.4.3Modals, drawers, sheets
accessibilityElementsHiddenbooleaniOS - hides element and children from VoiceOver1.1.1Decorative elements
importantForAccessibilitystringAndroid - 'auto' / 'yes' / 'no' / 'no-hide-descendants'1.1.1Decorative / grouped elements
accessibilityIgnoresInvertColorsbooleaniOS - preserves colors in Inverted Colors mode-Images, video
aria-labelstringAlias for accessibilityLabel1.1.1, 4.1.2Preferred in new code
aria-labelledbystringAndroid only - alias for accessibilityLabelledBy1.3.1Form inputs
rolestringAlias for accessibilityRole that takes ARIA role names (button, heading, listitem...)4.1.2All interactive elements
aria-checkedboolean / 'mixed'RN 0.73+ alias for accessibilityState.checked4.1.2Checkboxes
aria-disabledbooleanRN 0.73+ alias for accessibilityState.disabled4.1.2Disabled elements
aria-expandedbooleanRN 0.73+ alias for accessibilityState.expanded4.1.2Accordions, dropdowns
aria-selectedbooleanRN 0.73+ alias for accessibilityState.selected4.1.2Tabs, list items
aria-busybooleanRN 0.73+ alias for accessibilityState.busy4.1.3Loading elements
aria-hiddenbooleanRN 0.73+ - maps to importantForAccessibility / accessibilityElementsHidden1.1.1Decorative content
aria-livestringAndroid only - 'polite' / 'assertive' / 'off'4.1.3Dynamic content
aria-modalbooleaniOS only - alias for accessibilityViewIsModal2.4.3Modals

Accessibility Role Values

Each accessibilityRole, with the UIAccessibilityTraits value React Native sets on iOS and the class name it reports on Android (from React Native 0.88 source, RCTViewManager.m and ReactAccessibilityDelegate.kt). "None" means React Native adds no trait; the state props still apply. accessibilityRole has no listitem; the web-style role prop accepts listitem and other ARIA role names.

RoleiOS traitAndroid classUse For
'button'Buttonandroid.widget.ButtonButtons, submission triggers
'link'Linkandroid.view.ViewNavigation links, external URLs
'search'SearchFieldandroid.widget.EditTextSearch bars
'image'Imageandroid.widget.ImageViewImages (when accessible=true)
'imagebutton'Image + Buttonandroid.widget.ImageButtonIcon buttons
'header'Headerandroid.view.ViewHeadings
'text'StaticTextandroid.widget.TextViewStatic text
'adjustable'Adjustableandroid.widget.SeekBarSliders
'checkbox'Noneandroid.widget.CheckBoxCheckboxes
'combobox'Noneandroid.view.ViewDropdowns
'dropdownlist'Noneandroid.widget.SpinnerDropdown lists
'menu'Noneandroid.view.ViewMenus
'menuitem'Noneandroid.view.ViewMenu items
'menubar'Noneandroid.view.ViewMenu bars
'progressbar'UpdatesFrequentlyandroid.view.ViewProgress indicators
'radio'Noneandroid.widget.RadioButtonRadio buttons
'radiogroup'Noneandroid.view.ViewRadio button groups
'scrollbar'Noneandroid.view.ViewScrollbars
'spinbutton'Noneandroid.widget.SpinButtonSteppers, number inputs
'switch'switch trait (private)android.widget.SwitchToggle switches
'togglebutton'Buttonandroid.widget.ToggleButtonToggle buttons
'tab'Noneandroid.view.ViewTab elements
'tablist'Noneandroid.view.ViewTab containers
'timer'Noneandroid.view.ViewCountdown timers
'toolbar'Noneandroid.view.ViewToolbars
'grid'Noneandroid.widget.GridViewData grids
'list'Noneandroid.widget.AbsListViewLists
'summary'SummaryElementandroid.view.ViewSummary/status views
'alert'Noneandroid.view.ViewAlerts
'none'Noneandroid.view.ViewSuppress role

Touch Target Size Requirements

Each platform, with its minimum size, recommended and standard.

PlatformMinimum SizeRecommendedStandard
iOS44 x 44 pt44 x 44 ptHIG
Android48 x 48 dp48 x 48 dpMaterial Design
Web mobile44 x 44 CSS px (AAA)44 x 44 CSS pxWCAG 2.5.5
Web mobile (AA, 2.2)24 x 24 CSS px with spacing44 x 44 CSS pxWCAG 2.5.8

Detection Pattern (React Native)

// Violation: TouchableOpacity below minimum
const styles = StyleSheet.create({
  closeBtn: { width: 24, height: 24 },          // FAIL HIG - below 44pt (meets the 24px floor of 2.5.8)
  iconBtn: { width: 32, height: 32 },            // FAIL HIG - below 44pt
  navBtn: { padding: 4 },                        // CONDITIONAL - depends on content size
  compliant: { width: 44, height: 44 },          // PASS
  compliantWithPadding: { padding: 12 },         // PASS if content >= 20pt
});

iOS UIAccessibility - Quick Reference

SwiftUI Modifiers

Each modifier, with its purpose.

ModifierPurpose
.accessibilityLabel("...")Overrides spoken name
.accessibilityHint("...")Spoken usage hint (after pause)
.accessibilityValue("...")Spoken current value
.accessibilityHidden(true)Removes from VoiceOver tree
.accessibilityElement(children: .combine)Merges child elements into one node
.accessibilityElement(children: .contain)Groups children as sub-elements
.accessibilityElement(children: .ignore)Container becomes accessible, children hidden
.accessibilityAddTraits(.isButton)Adds role trait
.accessibilityRemoveTraits(.isImage)Removes wrong role trait
.accessibilityInputLabels(["..."])Voice Control activation labels
.accessibilitySortPriority(n)Overrides VoiceOver reading order (higher = earlier)
.accessibilityAction(named: "...", {})Custom action in the Actions rotor
.accessibilityActivationPoint(CGPoint)Override activation tap point
.accessibilityCustomContent("label", "value")Extra info in Accessibility Inspector

SwiftUI Trait Values

isButton, isHeader, isLink, isImage, isStaticText, isSelected, isKeyboardKey, isSearchField, playsSound, isModal, updatesFrequently, startsMediaSession, allowsDirectInteraction, causesPageTurn, isTabBar, isSummaryElement

UIKit Properties

Each property, with its type and notes.

PropertyTypeNotes
isAccessibilityElementBoolSet true on custom views
accessibilityLabelString?Overrides spoken name
accessibilityHintString?Spoken after pause
accessibilityValueString?Current value (sliders, progress)
accessibilityTraitsUIAccessibilityTraitsBitfield of traits (.button, .header, etc.)
accessibilityFrameCGRectDetermines VoiceOver focus rect
accessibilityActivate()funcOverride activation behavior
accessibilityElements[Any]?Set container's VoiceOver child order
shouldGroupAccessibilityChildrenBoolGroups all children into single node
accessibilityViewIsModalBooltrue = VoiceOver trapped inside
accessibilityElementsHiddenBoolHides all children from VoiceOver

Android Jetpack Compose Semantics - Quick Reference

Each modifier / property, with its purpose.

Modifier / PropertyPurpose
semantics { contentDescription = "..." }Accessible name
semantics { role = Role.Button }Element role
semantics { stateDescription = "..." }Current state text
semantics { heading() }Marks as heading
semantics { selected = true/false }Selected state
semantics { toggleableState = ToggleableState.On }Toggle state
semantics { onClick(label = "...", action = {...}) }Click action with label
semantics { disabled() }Disabled state
semantics { focused = true }Force focus
semantics { liveRegion = LiveRegionMode.Polite }Live region announcements
semantics { hideFromAccessibility() }Hide from TalkBack (replaces the deprecated invisibleToUser())
clearAndSetSemantics { ... }Replace all descendant semantics
Modifier.semantics(mergeDescendants = true) { }Short merge pattern

Role Values

Role.Button, Role.Checkbox, Role.DropdownList, Role.Image, Role.RadioButton, Role.Switch, Role.Tab


Common Violation Patterns and Fixes

RN-001: Missing accessibilityLabel on icon button

// VIOLATION
<TouchableOpacity onPress={close}>
  <Icon name="x" size={20} />
</TouchableOpacity>

// FIX
<TouchableOpacity
  onPress={close}
  accessibilityRole="button"
  accessibilityLabel="Close"
>
  <Icon name="x" size={20} aria-hidden />
</TouchableOpacity>

RN-002: Image missing label

// VIOLATION
<Image source={productImage} style={styles.product} />

// FIX - informational image
<Image
  source={productImage}
  style={styles.product}
  accessibilityLabel="Blue suede shoes, size 10"
/>

// FIX - decorative image
<Image
  source={decorativeBackground}
  style={styles.bg}
  accessible={false}
  importantForAccessibility="no"
/>

RN-003: TextInput missing label

// VIOLATION - placeholder is not a label
<TextInput placeholder="Email" value={email} onChangeText={setEmail} />

// FIX
<View>
  <Text nativeID="emailLabel">Email address</Text>
  <TextInput
    value={email}
    onChangeText={setEmail}
    accessibilityLabelledBy="emailLabel"
    accessibilityHint="Enter your email address"
    keyboardType="email-address"
    autoComplete="email"
  />
</View>

RN-004: Checkbox missing state

// VIOLATION
<TouchableOpacity onPress={toggle}>
  <Image source={checked ? checkedIcon : uncheckedIcon} />
  <Text>Accept terms</Text>
</TouchableOpacity>

// FIX
<TouchableOpacity
  onPress={toggle}
  accessibilityRole="checkbox"
  accessibilityState={{ checked }}
  accessibilityLabel="Accept terms and conditions"
>
  <Image source={checked ? checkedIcon : uncheckedIcon} accessible={false} />
  <Text>Accept terms</Text>
</TouchableOpacity>

RN-005: Modal not trapping focus

// VIOLATION - custom modal without VoiceOver trap
<View style={styles.modal}>
  <Text>Are you sure?</Text>
  <Button title="Confirm" onPress={confirm} />
</View>

// FIX - use the Modal component (it presents in its own window) or set
// accessibilityViewIsModal (iOS) on the container View
<Modal
  visible={visible}
  transparent
  onRequestClose={close}           // Android back button
>
  <View style={styles.overlay} accessibilityViewIsModal={true}>
    <Text>Are you sure?</Text>
    <Button title="Confirm" onPress={confirm} />
    <Button title="Cancel" onPress={close} />
  </View>
</Modal>

AND-001: Compose image missing content description

// VIOLATION
Image(
    painter = painterResource(id = R.drawable.product),
    contentDescription = null  // null = decorative, but wrong for informational image
)

// FIX - informational
Image(
    painter = painterResource(id = R.drawable.product),
    contentDescription = stringResource(R.string.product_image_description)
)

// FIX - truly decorative
Image(
    painter = painterResource(id = R.drawable.divider),
    contentDescription = null  // null is enough for a decorative Image
)

// FIX - decorative element that is not an Image (for example a separator Text)
Text(
    text = "\u2022",
    modifier = Modifier.semantics { hideFromAccessibility() }
)

Testing Tool Commands

iOS Accessibility Inspector (Xcode)

Xcode -> Xcode menu -> Open Developer Tool -> Accessibility Inspector
- Run audit: choose the target (Simulator or device), then use the Audit control
- Inspect: use the inspection pointer and hover over elements in Simulator
- VoiceOver is not available in Simulator; test VoiceOver on a device

Android Accessibility Scanner

# Install Accessibility Scanner from Google Play (package com.google.android.apps.accessibility.auditor).
# adb install needs an APK file path, not a package name.

# Enable TalkBack via ADB (for CI)
adb shell settings put secure enabled_accessibility_services \
  com.google.android.marvin.talkback/.TalkBackService

# Check accessibility node tree
adb shell uiautomator dump /sdcard/ui_dump.xml
adb pull /sdcard/ui_dump.xml

React Native Testing Library

npm install --save-dev @testing-library/react-native
import { render, screen, fireEvent } from '@testing-library/react-native';

// @testing-library/react-native 14: render() and fireEvent return Promises
test('button has accessible name and role', async () => {
  await render(<SubmitButton onPress={jest.fn()} />);
  const btn = screen.getByRole('button', { name: /submit/i });
  expect(btn).toBeOnTheScreen();
});

test('checkbox updates state', async () => {
  await render(<TermsCheckbox />);
  const checkbox = screen.getByRole('checkbox', { name: /accept terms/i });
  expect(checkbox).not.toBeChecked();
  await fireEvent.press(checkbox);
  expect(checkbox).toBeChecked();
});

Maestro (E2E)

# .maestro/accessibility-checks.yaml
appId: com.example.myapp
---
- launchApp
- assertVisible:
    label: "Submit form"
- tapOn:
    label: "Close"
- assertNotVisible:
    label: "Are you sure?"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.