Skip to content

a11y focus problem with DropdownMenuItems and BottomNavigationBar #44077

Closed

Description

@mehmetf

Internal: b/143551289

With a widget tree like:

Scaffold
  Navigator --> DropdownButton ...
  BottomNavigationBar

Open the dropdown's popup and navigate between the DropdownMenuItems.

Expected behavior: Screenreader linear navigation should take you between the DropdownMenuItems only. You should not be able to escape the popup while it is open (except maybe for the dismiss background area).

Actual behavior: The BottomNavigationBar items are reachable while the popup is open. It's like it treats the BottomNavigationBarItems as being in the same navigation plane(?) as DropdownMenuItems.

Issue is present on both iOS and Android.

Repro case:

import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String value = 'foo';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: Navigator(
          onGenerateRoute: (_) => MaterialPageRoute(builder: bodyBuilder),
        ),
        bottomNavigationBar: SafeArea(
            child: BottomNavigationBar(
          items: ['1', '2', '3']
              .map((item) => BottomNavigationBarItem(
                  icon: Icon(Icons.home), title: Text(item)))
              .toList(),
        )),
      ),
    );
  }

  Widget bodyBuilder(BuildContext context) => SafeArea(
        child: Center(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              DropdownButton(
                value: value,
                items: [
                  DropdownMenuItem(
                    value: 'foo',
                    child: Text('Foo'),
                  ),
                  DropdownMenuItem(
                    value: 'bar',
                    child: Text('Bar'),
                  ),
                  DropdownMenuItem(
                    value: 'baz',
                    child: Text('Baz'),
                  ),
                ],
                onChanged: (String value) {
                  setState(() {
                    this.value = value;
                  });
                },
              ),
              MaterialButton(
                child: Text('Reset'),
                onPressed: () {
                  setState(() {
                    this.value = 'foo';
                  });
                },
              ),
            ],
          ),
        ),
      );
}

Activity

  1. added
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    platform-iosiOS applications specifically
    platform-androidAndroid applications specifically
    on Nov 4, 2019
  2. rymotion commented on Nov 24, 2019

    @rymotion

    @mehmetf The possible issue here is that technically BottomNavigationBar and the dropdown menu are on the same route and looking into line 929 in dropdown.dart the issue is that we are essentially inserting a Semantics widgets into the widget tree meaning that the your menu and its children are now in the tree with your bottom NavigationBar what you need to do is remove that bottom NavigationBar from the Semantic tree changing your example to something more suitable. Possibly like an earlier issue (I was not able to locate the specific issue) #17088 might be the closest I can find. Either way swap out the Scaffold for a Stack with a alignment to the center bottom

  3. darshankawar commented on Jul 10, 2020

    @darshankawar
    Member

    Issue is replicable on latest dev channel. With accessibility ON and when dropdown menu items are displayed, slide to navigate between menu items which takes control to bottom navigation bar items after last menu item.

    44077

  4. huycozy commented on Jul 5, 2022

    @huycozy
    Member

    Hi, this issue is reproducible on the latest stable and master channels with provided sample code.
    It seems the issue is only reproducible on Android. On iOS, the BottomNavigationBar items are not reachable while the popup is open.

    Demo
    • Android:
    XRecorder_05072022_171114.mp4
    • iOS:
    Image.from.iOS.2.MP4
    flutter doctor -v
    [✓] Flutter (Channel stable, 3.0.4, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
        • Flutter version 3.0.4 at /Users/huynq/Documents/GitHub/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 85684f9300 (3 days ago), 2022-06-30 13:22:47 -0700
        • Engine revision 6ba2af10bb
        • Dart version 2.17.5
        • DevTools version 2.12.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 31.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [!] Android Studio
        • Android Studio at /Applications/Android Studio Preview.app/Contents
        • 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
        ✗ Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • 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.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Community Edition (version 2020.3.3)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • 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
    
    [✓] IntelliJ IDEA Community Edition (version 2022.1.1)
        • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
        • 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
    
    [✓] VS Code (version 1.68.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.42.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.53
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    [✓] Flutter (Channel master, 3.1.0-0.0.pre.1501, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
        • Flutter version 3.1.0-0.0.pre.1501 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 753fee42cf (89 minutes ago), 2022-07-04 22:09:02 -0400
        • Engine revision 94b47cc0eb
        • Dart version 2.18.0 (build 2.18.0-254.0.dev)
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 31.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13E113
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [!] Android Studio
        • Android Studio at /Applications/Android Studio Preview.app/Contents
        • 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
        ✗ Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • 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.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Community Edition (version 2020.3.3)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • 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
    
    [✓] IntelliJ IDEA Community Edition (version 2022.1.1)
        • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
        • 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
    
    [✓] VS Code (version 1.68.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.42.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.114
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
  5. added
    fyi-accessibilityFor the attention of Framework Accessibility team
    P2Important issues not at the top of the work list
    on Dec 11, 2024
  6. chunhtai commented on Dec 12, 2024

    @chunhtai
    Contributor

    This should be fixed after menu anchor is migrated to overlay portal

  7. added
    r: fixedIssue is closed as already fixed in a newer version
    on Dec 13, 2024
  8. github-actions commented on Dec 27, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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)found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.fyi-accessibilityFor the attention of Framework Accessibility teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions