Skip to content

[Windows] Accessibility of dialogs #101289

Open
@chrisnorman7

Description

@chrisnorman7

Hi,
When using the pushDialog function with an instance of AlertDialog (and probably other Dialog instances too), the accessibility leaves a lot to be desired.

Code

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter(final BuildContext context) {
    showDialog(
        context: context,
        builder: (context) => AlertDialog(
              actions: [
                TextButton(
                  onPressed: () {
                    Navigator.pop(context);
                    setState(() {
                      _counter++;
                    });
                  },
                  child: const Text('OK'),
                )
              ],
              content: Text('Counter: $_counter.'),
            ));
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => _incrementCounter(context),
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Under Windows, using NVDA, when I press the button nothing is even spoken until I use the tab key. Same when running with Chrome, also using NVDA.

Flutter Doctor

[] Flutter (Channel master, 2.13.0-0.0.pre.366, on Microsoft Windows [Version 10.0.22000.556], locale en-GB)
    ÔÇó Flutter version 2.13.0-0.0.pre.366 at C:\Users\chris\flutter
    ÔÇó Upstream repository https://github.com/flutter/flutter.git
    ÔÇó Framework revision 0b97874895 (2 days ago), 2022-04-01 21:20:01 -0400
    ÔÇó Engine revision 801d8c530f
    ÔÇó Dart version 2.17.0 (build 2.17.0-265.0.dev)
    ÔÇó DevTools version 2.12.1

[] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
    ÔÇó Android SDK at C:\Users\chris\AppData\Local\Android\sdk
    ÔÇó Platform android-31, build-tools 31.0.0-rc2
    ÔÇó Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    ÔÇó Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    ÔÇó All Android licenses accepted.

[] Chrome - develop for the web
    ÔÇó Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[] Visual Studio - develop for Windows (Visual Studio Enterprise 2022 17.1.0)
    ÔÇó Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Enterprise
    ÔÇó Visual Studio Enterprise 2022 version 17.1.32210.238
    ÔÇó Windows 10 SDK version 10.0.22000.0

[] Android Studio (version 2020.3)
    ÔÇó Android Studio at C:\Program Files\Android\Android Studio
    ÔÇó Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    ÔÇó Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    ÔÇó Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[] VS Code, 64-bit edition (version 1.66.0)
    ÔÇó VS Code at C:\Program Files\Microsoft VS Code
    ÔÇó Flutter extension version 3.27.0

[] Connected device (4 available)
    ÔÇó Windows (desktop)       ÔÇó windows ÔÇó windows-x64     ÔÇó Microsoft Windows [Version 10.0.22000.556]
    ÔÇó Windows (UWP) (desktop) ÔÇó winuwp  ÔÇó windows-uwp-x64 ÔÇó 
    ÔÇó Chrome (web)            ÔÇó chrome  ÔÇó web-javascript  ÔÇó Google Chrome 99.0.4844.84
    ÔÇó Edge (web)              ÔÇó edge    ÔÇó web-javascript  ÔÇó Microsoft Edge 98.0.1108.56

[] HTTP Host Availability
    ÔÇó All required HTTP hosts are available

ÔÇó No issues found!

Thanks in advance.

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)a: desktopRunning on desktopf: material designflutter/packages/flutter/material repository.found in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions