Skip to content

[a11y][iOS] bottomNavigationBar cannot be navigated using Switch Control #160033

@ChristianEdwardPadilla

Description

@ChristianEdwardPadilla

Steps to reproduce

  1. Enable Switch Control in iOS settings app (https://support.apple.com/en-us/119835).
  2. Using the repro app below, attempt to navigate between NavigationDestinations within the NavigationBar.

Expected results

It is possible to navigate between NavigationDestination tabs.

Actual results

Focus seems to be stuck on a single NavigationDestination tab.

Code sample

Code sample
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<MyHomePage> {
  int _counter = 0;
  int _selectedIndex = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  void _changeIndex(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title, style: TextStyle(fontFamily: 'ProductSans')),
      ),
      body: Center(
        child: Column(
          children: [
            Text(
              'Button tapped $_counter time${_counter == 1 ? '' : 's'}.',
              // This optional key is used to uniquely identify this widget in
              // the integration test at: test_driver/tap_test.dart.
              key: Key('CountText'),
              style: TextStyle(fontSize: 24),
            ),
            MaterialButton(
              onPressed: () {
                print('Button tapped');
              },
              color: Colors.blue,
              child: Text('Test button 1'),
            ),
            MaterialButton(
              onPressed: () {
                print('Button tapped');
              },
              color: Colors.blue,
              child: Text('Test button 2'),
            ),
            MaterialButton(
              onPressed: () {
                print('Button tapped');
              },
              color: Colors.blue,
              child: Text('Test button 3'),
            ),
          ],
        ),
      ),
      bottomNavigationBar: NavigationBar(
        onDestinationSelected: (index) {
          print('Selected destination $index');
          _incrementCounter();
          _changeIndex(index);
        },
        selectedIndex: _selectedIndex,
        destinations: [
          NavigationDestination(label: 'one', icon: Icon(Icons.home)),
          NavigationDestination(label: 'two', icon: Icon(Icons.home)),
          NavigationDestination(label: 'three', icon: Icon(Icons.home)),
        ],
      ),
    );
  }
}

Screenshots or Video

Video demonstration
IMG_4624.MP4

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel google3)
    • Framework revision 1d60fc7843 (2 days ago), 2024-12-08T00:00:00.000
    • Engine revision 82d7c1b2c2
    • Dart version c7e47c6c5d

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode_16.0.0.app/Contents/Developer
    • Build 16A242d

Google bug tracker: b/382363824.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: googleVarious Google teamsf: focusFocus traversal, gaining or losing focusf: material designflutter/packages/flutter/material repository.found in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)triaged-accessibilityTriaged by Framework Accessibility team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions