Skip to content

iOS a11y focus gets drawn back to Flutter from system dialog  #93030

@dnfield

Description

@dnfield

Steps: enable voice over, launch app, press the button, wait for the progress indicator to start. Focus will go tback to the button and not be able to get to the system dialog, when it really should be staying on the system dialog.

I've checked that the semantics ID stays stable. I suspected that maybe the progress indicator was adding some kind of updated frequently flag but it does not. I'm wondering if this has anything to do with the way we update the tree, but this seems like a bug in iOS - it shouldn't be allowing some view behind the modal to grab a11y focus...

A work around is to not include the progress indicator. Filing this as a p4 since I think the work around will be acceptable to the internal customer.

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


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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class MyAppState extends State<MyApp> {
  bool _loading = false;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Demo'),
        ),
        body: ElevatedButton(
          child: _loading
              ? const CircularProgressIndicator()
              : const Text('Press me'),
          onPressed: () async {
            setState(() {
              _loading = true;
            });
            final Location location = Location();

            bool _serviceEnabled;
            PermissionStatus? _permissionGranted;
            LocationData? _locationData;

            _serviceEnabled = await location.serviceEnabled();
            if (!_serviceEnabled) {
              _serviceEnabled = await location.requestService();
              if (!_serviceEnabled) {
                return;
              }
            }

            _permissionGranted = await location.hasPermission();
            if (_permissionGranted == PermissionStatus.denied) {
              _permissionGranted = await location.requestPermission();
              if (_permissionGranted != PermissionStatus.granted) {
                return;
              }
            }

            _locationData = await location.getLocation();
            print(_locationData);
            setState(() {
              _loading = false;
            });
          },
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: money (g3)engineflutter/engine related. See also e: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions