flutter / flutter/flutter

[A11y][iOS]: SnackBar shows more Voice Control labels than expected

Open
#157,630 11 comments 0 reactions 1 assignee Claimed by @LouiseHsu View on GitHub
a: accessibility customer: quake (g3) found in release: 3.24 found in release: 3.27 p: material_ui P2 package platform-ios team-ios triaged-ios
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

Tracking b/325610878.

### Steps to reproduce

1. Enable iOS Voice Control in the settings app.
2. In a Flutter app (minimal sample app below), cause a Material SnackBar widget to be displayed.
3. Observe the Voice Control labels.

### Expected results

There should be labels for interactive UI elements.

### Actual results

There are more labels than there are interactive UI elements.

This was observed for Material2 and Material3 themes.

### Code sample

Code sample

```dart
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: false),
title: 'Flutter Demo',
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
void displaySnackBar(BuildContext context) {
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('test bar'),
// // Enable these in order to see more numbered labels with iOS Voice Control.
// action: SnackBarAction(
// label: 'close',
// onPressed: () => print('close'),
// ),
// showCloseIcon: true,
),
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title, style: TextStyle(fontFamily: 'ProductSans')),
),
body: Center(
child: Text(
'test',
key: Key('CountText'),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => displaySnackBar(context),
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
```

### Screenshots or Video

screenshot of extra labels

![IMG_0093](https://github.com/user-attachments/assets/4d13678d-c277-42b1-911b-d8fd9d3904ea)

### Logs

Logs

```console
[Paste your logs here]
```

### Flutter Doctor output

Doctor output

```console
[✓] Flutter (Channel google3, on macOS 14.7 23H124 darwin-x64, locale en)
• Framework revision 3cd12f2c06 (0 days ago), 2024-10-25T00:00:00.000
• Engine revision c4b0184c87
• Dart version 3067d697ae

[✓] Android toolchain - develop for Android devices (Android SDK version Stable)
• Android SDK at google3
• Platform Stable, build-tools Stable
• Java binary at: /Applications/Android Studio with Blaze
Beta.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915915-b509.11)

[✓] VS Code (version 1.94.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.86.0

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
• Xcode at /Applications/Xcode.app/Contents/Developer

[✓] Connected device (1 available)
! Error: Browsing on the local area network for CP’s iPhone (2). Ensure the
device is unlocked and attached with a cable or associated with the same
local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code
-27)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.