0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AIが作るアプリのアクセシビリティ — contentDescriptionだけで差がつく

0
Posted at

AIが自動生成したAndroidアプリも、ユーザーに優しくなければGoogle Playの審査に落ちます。今回は、アクセシビリティ実装の「最小限で最大効果」な方法をお教えします。

アクセシビリティが重要な理由

Google Playは2024年からアクセシビリティ基準を審査項目に追加しました。以下のいずれかに該当すると、即不承認です:

  • 画像・アイコンに説明がない
  • ボタンが小さすぎる(48dp未満)
  • 色だけで情報を区別している(色弱者対応なし)

さらに、「聞く」「見る」という多様な使い方をするユーザーは、実は全体の15-20%。つまり、アクセシビリティ対応 = ターゲット層を20%増やすことです。

1. contentDescription — 画像・アイコンに説明をつける

最も簡単で効果的な実装:

Image(
    painter = painterResource(id = R.drawable.ic_settings),
    contentDescription = "設定メニューを開く",
    modifier = Modifier.size(24.dp)
)

IconButton(
    onClick = { /* ... */ }
) {
    Icon(
        imageVector = Icons.Default.Share,
        contentDescription = "この記事をシェアする",
        tint = Color.Blue
    )
}

重要: contentDescription = null を使うのは、装飾画像だけです。

// OK: 装飾画像
Image(
    painter = painterResource(id = R.drawable.decorative_border),
    contentDescription = null
)

// NG: 情報を持つアイコン
Icon(
    imageVector = Icons.Default.Favorite,
    contentDescription = null  // ← これはダメ!TalkBackで何も読まれない
)

2. Jetpack Composeのセマンティクス

Composeではデフォルトで多くのAccessibility情報が自動設定されています。カスタマイズが必要なときはsemantics修飾子を使います:

Button(
    onClick = { deleteItem() },
    modifier = Modifier.semantics {
        // ボタンの説明を明確にする
        contentDescription = "このタスクを削除する"
        // アクション名をカスタマイズ
        customActions = listOf(
            CustomAccessibilityAction("削除する") { deleteItem(); true }
        )
    }
) {
    Icon(Icons.Default.Delete, contentDescription = null)
    Text("削除")
}

3. TalkBack対応を実際にテストする

adb shell でTalkBackを有効にして、本当に読まれているか確認:

# TalkBackを有効化
adb shell settings put secure enabled_accessibility_services \
  com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService

# アプリを起動して、画面をなぞって確認
# 各要素が正しく読上げられるか聞く

4. タッチ対象サイズ(Minimum Touch Target)

ボタンやアイコンは最低48dp×48dp。これはAndroid標準(Material Design)です:

// NG: 小さすぎる
Button(modifier = Modifier.size(32.dp)) { Text("小") }

// OK: 48dp以上
Button(modifier = Modifier.size(48.dp)) { Text("OK") }

// 意外な落とし穴: Icon()は自動的には48dpにならない
IconButton(  // ← これは自動で48dp化される
    onClick = { }
) {
    Icon(Icons.Default.Settings, contentDescription = "設定")
}

// でも素のIcon()は:
Icon(
    imageVector = Icons.Default.Settings,
    contentDescription = "設定",
    modifier = Modifier.size(32.dp)  // ← 小さい!clickable()をつけるなら48dp必須
        .clickable { }
)

5. 色対比(Color Contrast)

色だけで情報を区別してはいけません:

// NG: 赤色だけで「エラー」を表現
Text("エラーが発生しました", color = Color.Red)

// OK: 色 + アイコン + テキスト
Row(verticalAlignment = Alignment.CenterVertically) {
    Icon(
        imageVector = Icons.Default.Error,
        contentDescription = null,
        tint = Color.Red
    )
    Text("エラーが発生しました")
}

さらに、WCAG基準では最小コントラスト比4.5:1が要件。Composeテーマで自動対応する場合が多いですが、カスタム色を使う場合は確認:

// Material3 の LocalContentColor を使うと自動対応
Text(
    "このテキストは背景色に自動調整されます",
    color = LocalContentColor.current
)

6. AI生成アプリでの実装パターン

Androidアプリ自動生成ツールを使う場合、以下を確認:

  • すべての画像にcontentDescriptionあり
  • ボタン類が48dp以上
  • 色だけでは判別できない情報表示
  • フォーカス順序が左→右、上→下の自然な流れ
  • テキストサイズが最小14sp以上

これらをAI指示に含める:

Create an Android app with:
- All images must have contentDescription in Japanese
- Minimum button size 48dp
- Color contrast ratio 4.5:1 or higher
- Support TalkBack screen reader

まとめ

アクセシビリティは「特別な機能」ではなく、品質基準です。AIが自動生成するアプリこそ、人間の多様性に寄り添う設計が必須。

contentDescriptionを書く、タッチサイズを確認する、TalkBackでテストする — この3つだけで、Google Play審査の90%の懸念は解消されます。

8種類のAndroidアプリテンプレート → https://myougatheax.gumroad.com

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?