Skip to main content
Accessibility
for teams

Accessibility for mobile developers

full guide

People use your app with VoiceOver, TalkBack, large text, voice control or a switch, often on the go and with one hand. Most of that works if you use the controls iOS and Android give you, and tell the system what your own controls do. This guide helps you build accessible apps and keep them accessible. It is a starting point.

New to accessibility? Where to start as a team

How to build accessible apps

chapter 1

Native controls

Must know: Use the platform’s own controls

A Button in SwiftUI or Jetpack Compose is announced as a button. It works with VoiceOver, TalkBack, Switch Control and a keyboard, and its text grows with the user’s text size. A Text with a tap gesture does none of that.

Style the standard control the way the design asks. That is almost always less work than rebuilding its behaviour.

If you really build your own control, tell the system what it is: .accessibilityAddTraits(.isButton) in SwiftUI, Modifier.semantics { role = Role.Button } in Compose.

A button that saves a form.

Don’t

// SwiftUI
Text("Save")
    .onTapGesture { save() }

// Jetpack Compose
Box(modifier = Modifier.clickable { save() }) {
    Text("Save")
}

Do

// SwiftUI
Button("Save") {
    save()
}

// Jetpack Compose
Button(onClick = { save() }) {
    Text("Save")
}
WCAG 2.1.1 KeyboardWCAG 4.1.2 Name, Role, Value

Mark headings as headings

VoiceOver and TalkBack users jump from heading to heading to find their way around a screen, just like on the web. Big bold text is not a heading for them.

  • SwiftUI: .accessibilityAddTraits(.isHeader).
  • Jetpack Compose: Modifier.semantics { heading() }.
  • Android Views: ViewCompat.setAccessibilityHeading(view, true).
WCAG 1.3.1 Info and Relationships

Give every screen a title and the right language

When a new screen opens, its title tells screen reader users where they are.

  • SwiftUI: a NavigationStack with a .navigationTitle on every screen.
  • Jetpack Compose: a Scaffold with a TopAppBar on every screen. For a panel that changes without a new screen, set a pane title: Modifier.semantics { paneTitle = "…" }.

Localise your app properly, so the screen reader uses the right voice. Mark words in another language too: the .accessibilitySpeechLanguage attribute of an AttributedString in SwiftUI, a SpanStyle with a localeList in Compose.

WCAG 2.4.2 Page TitledWCAG 3.1.1 Language of PageWCAG 3.1.2 Language of Parts

Know what your framework passes on

React Native, Flutter and .NET MAUI translate their components to native controls, but not everything makes it through. Each framework has its own way to set names and roles: accessibilityLabel and accessibilityRole in React Native, the Semantics widget in Flutter, SemanticProperties in .NET MAUI.

Test the app itself on a real phone with VoiceOver and TalkBack, not only the framework’s preview.

WCAG 4.1.2 Name, Role, Value

Screen readers

Must know: Give every control an accessible name

A screen reader announces the name of every button, link and field. Without a name, an icon button is just “button”, or the file name of the image.

Give icons a label: .accessibilityLabel("Search") in SwiftUI, contentDescription = "Search" in Compose. Don’t put the role in the label, like “Search button”: the screen reader already says it.

If a control has visible text, the name must contain that text. Voice Control and Voice Access users say what they see, like “tap Send”. In SwiftUI you can add other words people might say with .accessibilityInputLabels.

A search button with only an icon.

Don’t

// SwiftUI
Button {
    search()
} label: {
    Image("icon_search")
}

// Jetpack Compose
IconButton(onClick = { search() }) {
    Icon(
        imageVector = Icons.Default.Search,
        contentDescription = null
    )
}

Do

// SwiftUI
Button {
    search()
} label: {
    Image("icon_search")
        .accessibilityLabel("Search")
}

// Jetpack Compose
IconButton(onClick = { search() }) {
    Icon(
        imageVector = Icons.Default.Search,
        contentDescription = "Search"
    )
}
WCAG 4.1.2 Name, Role, ValueWCAG 2.5.3 Label in Name

Describe images, or hide them

An image that adds information gets a label: .accessibilityLabel("…") in SwiftUI, contentDescription = "…" in Compose.

A decorative image is hidden from the screen reader, so users don’t have to swipe past it:

  • SwiftUI: .accessibilityHidden(true).
  • Jetpack Compose: contentDescription = null.

The guide for content designers explains what a good text alternative says.

WCAG 1.1.1 Non-text Content

Group what belongs together

A card with a title, a price and a rating should be one stop for the screen reader, not five.

  • SwiftUI: .accessibilityElement(children: .combine) on the card.
  • Jetpack Compose: Modifier.semantics(mergeDescendants = true) { } on the card.

Check the reading order too. The screen reader goes from top left to bottom right, which is not always the order that makes sense. Fix it with .accessibilitySortPriority in SwiftUI, or isTraversalGroup and traversalIndex in Compose, not by moving things around on the screen.

WCAG 1.3.1 Info and RelationshipsWCAG 1.3.2 Meaningful SequenceWCAG 2.4.3 Focus Order

Keep states and values up to date

Selected, expanded, on or off: the screen reader must hear it, not only see a colour change. Standard controls already do this. A Toggle says “on” or “off”, a Slider says its value.

For a control you build yourself:

  • SwiftUI: .accessibilityAddTraits(.isSelected) for a selected state, .accessibilityValue("Expanded") for other states and values.
  • Jetpack Compose: selected = true or stateDescription = "Expanded" in Modifier.semantics.

Update the state in the code at the same moment it changes on the screen.

WCAG 4.1.2 Name, Role, Value

Offer another way for every gesture

Swipe to delete, pinch to zoom and long press for a menu are hard or impossible with a screen reader, a switch or one hand.

Add custom actions, so screen reader users find them in the actions menu:

  • SwiftUI: .accessibilityAction(named: "Delete") { … }.
  • Jetpack Compose: customActions with a CustomAccessibilityAction in Modifier.semantics.

Better still, also show a visible button, like Enlarge and Shrink next to an image people can pinch. That helps everyone who can’t do the gesture, not only screen reader users.

WCAG 2.1.1 KeyboardWCAG 2.5.1 Pointer Gestures

Announce changes that don’t move focus

“Added to basket” or “Search in progress”: the screen reader user doesn’t see it appear, so tell them.

  • SwiftUI: post an announcement. On iOS 17 and higher with AccessibilityNotification.Announcement("…").post(), before that with UIAccessibility.post(notification: .announcement, argument: "…").
  • Jetpack Compose: make the text a live region with liveRegion = LiveRegionMode.Polite in Modifier.semantics.

Use polite announcements, which wait until the screen reader is done talking. Interrupt only for something urgent. And don’t announce everything: a screen reader that never stops talking gets turned off.

WCAG 4.1.3 Status Messages

Move focus when the screen changes

When a dialog opens, focus goes into it, and the screen behind it can’t be reached. The standard dialogs do this for you: .alert in SwiftUI and AlertDialog in Compose. Always give them a cancel or dismiss button.

If you build your own modal view, add .accessibilityAddTraits(.isModal) in SwiftUI. In Compose, a pane title gives the panel a name, but it doesn’t keep focus inside it.

To move focus yourself, for example to a message that just appeared, use @AccessibilityFocusState with .accessibilityFocused in SwiftUI, or a FocusRequester in Compose.

WCAG 2.4.3 Focus Order

Text size and display

Must know: Let text grow with the user’s setting

Many people use a larger text size. On iOS, the accessibility sizes go well beyond 200%.

  • SwiftUI: use text styles, like .font(.title) or .font(.headline). A Text without a font uses the body style and scales by itself. For a custom font, use .font(.custom(name, size: size, relativeTo: .body)). In UIKit, use UIFontMetrics.
  • Android: set every text size in sp, preferably once, in your Typography.

Then make sure the layout can grow with it. Let text wrap instead of cutting it off, don’t give text a fixed height or width, and put the content in a ScrollView or a scrollable Column. The guide for UX and UI designers explains how to design for large text.

A label in a box with a fixed size. With a large text size, the text is cut off.

Don’t

// SwiftUI
Text("Delivery address")
    .lineLimit(1)
    .frame(width: 100, height: 100)

// Jetpack Compose
Text(
    text = "Delivery address",
    maxLines = 1,
    modifier = Modifier
        .width(100.dp)
        .height(100.dp)
)

Do

// SwiftUI
ScrollView {
    Text("Delivery address")
}

// Jetpack Compose
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
    Text(text = "Delivery address")
}
WCAG 1.4.4 Resize TextWCAG 1.4.10 Reflow

Don’t lock the orientation

Some people have their phone or tablet mounted on a wheelchair, in landscape. Support both orientations, unless one is essential, like for a piano app.

  • iOS: list all orientations under UISupportedInterfaceOrientations in Info.plist.
  • Android: remove android:screenOrientation from your manifest.

Then check that every screen still works in landscape, also with a large text size.

WCAG 1.3.4 Orientation

Respect the user’s display settings

iOS and Android let people reduce motion, make text bold and choose dark mode. Standard controls follow these settings. Check them where you set something yourself:

  • Reduce motion. Turn off animations that aren’t essential. SwiftUI: UIAccessibility.isReduceMotionEnabled. Android: the animation scales ANIMATOR_DURATION_SCALE and TRANSITION_ANIMATION_SCALE are 0.
  • Bold text. If you set a font weight yourself, check the setting. SwiftUI: the legibilityWeight environment value. Compose: fontWeightAdjustment in the configuration, on Android 12 and higher.
  • Dark mode. Give colours and images a dark version in your assets, or check colorScheme in SwiftUI and isSystemInDarkTheme() in Compose.
WCAG 2.2.2 Pause, Stop, HideWCAG 2.3.3 Animation from Interactions

Check contrast in light and dark mode

Use the colours from your design system, and check every screen in light and dark mode. A colour that works on white often doesn’t work on black.

Tools find most contrast problems for you: Accessibility Inspector in Xcode, Accessibility Scanner on Android, and the Compose UI checks on previews in Android Studio.

On iOS, people can also turn on Increase Contrast. You can read it with the colorSchemeContrast environment value in SwiftUI.

The guide for UX and UI designers explains which contrast you need.

WCAG 1.4.3 Contrast (Minimum)WCAG 1.4.11 Non-text Contrast

Touch, keyboard and voice

Must know: Make touch targets big enough

Small targets are hard to hit with a tremor, on a moving train or with a big thumb. WCAG asks for at least 24 by 24 points or dp. Apple recommends 44 by 44 points and Material Design 48 by 48 dp: follow those.

The touch area can be bigger than the icon. Set the minimum size on the button, not on the image inside it:

  • SwiftUI: .frame(minWidth: 44, minHeight: 44).
  • Jetpack Compose: Modifier.widthIn(min = 48.dp).heightIn(min = 48.dp).
A 16 px icon inside a 44 × 44 px target
WCAG 2.5.8 Target Size (Minimum)

Support keyboards and switches

People connect a keyboard to a tablet, or use Full Keyboard Access, Switch Control or Switch Access. Every control must be reachable in a logical order, and it must be clear where the focus is.

Standard controls do this. For your own controls:

  • SwiftUI: .accessibilityRespondsToUserInteraction(true) makes an element reachable with Full Keyboard Access, .accessibilitySortPriority changes the order.
  • Jetpack Compose: Modifier.focusable() makes an element reachable, focusProperties changes the order. Show the focus, for example with a border that changes in onFocusChanged.
WCAG 2.1.1 KeyboardWCAG 2.4.3 Focus OrderWCAG 2.4.7 Focus Visible

Don’t depend on motion or dragging

Shake to undo or tilt to scroll doesn’t work for someone whose phone is mounted on a wheelchair, or who can’t move it precisely. Dragging is hard with a tremor or a switch.

  • Give every action you trigger with motion a button as well.
  • Give every slider and every list you can reorder by dragging a way to do it with single taps, like − and + buttons next to a slider.
WCAG 2.5.4 Motion ActuationWCAG 2.5.7 Dragging Movements

Forms and login

Give every field a visible label

A placeholder disappears as soon as you type, and is not always read out. Show a label with every field, and make sure the screen reader reads it when the field gets focus.

  • SwiftUI: put the TextField in a LabeledContent with the label.
  • Jetpack Compose: use the label of the TextField. Compose has no built-in way to link a separate text to a field.

The guide for UX and UI designers explains how to design accessible forms.

WCAG 1.3.1 Info and RelationshipsWCAG 3.3.2 Labels or Instructions

Make errors reach everyone

Show the error in text, not only as a red line, and say how to fix it: “Enter a date like 01/01/2000.” Then make sure the screen reader hears it.

  • SwiftUI: show the message in a Text and post it as an announcement.
  • Jetpack Compose: set isError on the TextField, show the message in its label, and add error(message) in Modifier.semantics.

In Compose, check that androidx.compose.ui.semantics.error is imported. Otherwise Kotlin uses its standard error function, which throws an exception.

WCAG 3.3.1 Error IdentificationWCAG 3.3.3 Error SuggestionWCAG 4.1.3 Status Messages

Help the keyboard, autofill and password managers

Typing on a phone is hard for many people. Tell the system what a field is for, so it can show the right keyboard and fill it in:

  • SwiftUI: .textContentType(.emailAddress) and .keyboardType(.emailAddress). Use .username and .password on login fields, so password managers find them.
  • Jetpack Compose: keyboardOptions with the right KeyboardType, and autofill with the right type for each field.

Don’t make people remember or retype a password or code. Never block pasting into a password or code field, and offer a way in without a password, like a sign-in link by email.

WCAG 1.3.5 Identify Input PurposeWCAG 3.3.8 Accessible Authentication (Minimum)

Making accessibility part of your work

chapter 2

Accessibility is cheapest to fix in the code you are writing today. Before you open a pull request, try your screen with VoiceOver or TalkBack and with the largest text size.

Build to WCAG 2.2 level AA. WCAG was written for the web, but EN 301 549 applies the same criteria to apps, and WCAG2ICT explains how each one applies to software. The guide for product managers explains which law refers to which version.

In your workflow

Must know: Test on a real device

The iOS Simulator has no VoiceOver, and an emulator doesn’t feel like a phone in your hand. Before you open a pull request, test your screen on a real device:

  • With VoiceOver or TalkBack. Swipe through the screen, double-tap to activate, and listen to what you hear.
  • With the largest text size, in portrait and in landscape.
  • With Voice Control or Voice Access: can you say what you see?
  • With a keyboard connected, if your app runs on a tablet.

Set up the accessibility shortcut on your phone, so you can turn the screen reader on and off quickly. The guide for testing explains what to look for.

Use the platform’s inspection tools

You don’t need a screen reader to see what it will say.

  • Accessibility Inspector, in Xcode, shows the label, traits and value of each element, and can audit a screen for common problems.
  • Accessibility Scanner, an app for Android, scans the screen on your phone and suggests improvements, such as bigger targets or more contrast.
  • The Compose UI checks in Android Studio find common problems in your previews while you build.

Let tests catch the easy mistakes

Automated checks find the mistakes a computer can see: a missing label, a target that is too small, too little contrast. Let them run where you already work:

  • On iOS, run an accessibility audit in your UI tests with XCUIAccessibilityAudit.
  • On Android, add the Accessibility Test Framework for Android to your UI tests.
  • Use a linter: SwiftLint and Android Lint have a few accessibility rules.

Tools find only part of the issues. A clean report doesn’t mean your app is accessible.

Include accessibility in code review

Add a few fixed questions to every code review:

  • Does every control have a name, a role and the right state?
  • Does it still work with the largest text size?
  • Can you do everything without gestures, motion or dragging?

Agree with your team that a pull request with known accessibility issues is not done.

Tell users what your app supports

In the App Store, you can add Accessibility Nutrition Labels to your app. They tell people before they download whether they can complete common tasks in your app with VoiceOver, Voice Control, Larger Text, Reduced Motion and other features. Only claim what you have tested, from start to finish.

Publish an accessibility statement for your app too. It says what doesn’t work yet and how people can contact you when they get stuck.

Learning more

Must know: Look it up for your platform

This guide is a starting point. When you need to know how something works on your platform, look it up on Appt. It is the best accessibility resource for app developers I know.

Appt explains each accessibility feature and each WCAG criterion for apps, with code for iOS, Android and cross-platform frameworks. The code examples in this guide follow their samples.