Skip to content

Screen reader loses focus from previous route after navigation #118397

Closed

Description

@Albert221

After navigating the semantics nodes with a screen reader (right/left swipes), entering a new page (Navigator.push), and returning from it (Navigator.pop), the screen reader is focused on the beginning of a route instead of on the last focused node.

This is an issue that the accessibility consultant from my project pointed out and it's a big blocker for people with disabilities to effectively use the application that has forms with full-page pickers.

I tested it only on iPhone's VoiceOver.

Test environment

iPhone 13 Pro, iOS 16.0.2

[✓] Flutter (Channel stable, 3.3.8, on macOS 13.1 22C65 darwin-arm, locale en-PL)
    • Flutter version 3.3.8 on channel stable at /Users/albert/fvm/versions/3.3.8
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (9 weeks ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

Demo

Those videos have audio with VoiceOver voice.

Sample Flutter app

IMG_0105.MOV

iOS Settings app

IMG_0107.MOV

Sample app code

import 'package:flutter/material.dart';

void main() {
  runApp(
    const MaterialApp(home: RootWidget()),
  );
}

class RootWidget extends StatelessWidget {
  const RootWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Root route'),
      ),
      body: Column(
        children: [
          ListTile(
            title: const Text('A'),
            onTap: () => Navigator.of(context).push(
              MaterialPageRoute(
                builder: (_) => const ChildPage(text: 'A'),
              ),
            ),
          ),
          ListTile(
            title: const Text('B'),
            onTap: () => Navigator.of(context).push(
              MaterialPageRoute(
                builder: (_) => const ChildPage(text: 'B'),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class ChildPage extends StatelessWidget {
  const ChildPage({super.key, required this.text});

  final String text;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Child route: $text'),
      ),
      body: Center(
        child: Text('Hello there: $text'),
      ),
    );
  }
}

Activity

  1. Albert221 commented on Jan 12, 2023

    @Albert221
    ContributorAuthor

    I may try to fix that if that's considered a bug and not intended behavior, but I'd like some minimal guidance on where to cache the semantics focus position and where/how this focus is maintained

  2. darshankawar commented on Jan 13, 2023

    @darshankawar
    Member

    Thanks for the report. I see the same behavior upon navigating back from child to root screen, the focus goes to the app heading. Verified on iPhone 6s.
    Although it could be related to #97747

    stable, master flutter doctor -v
    [✓] Flutter (Channel stable, 3.3.10, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.3.10 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 135454af32 (15 hours ago), 2022-12-15 07:36:55 -0800
        • Engine revision 3316dd8728
        • Dart version 2.18.6
        • DevTools version 2.15.0
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [[!] Flutter (Channel master, 3.7.0-20.0.pre.28, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.7.0-20.0.pre.28 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 59d737e647 (81 minutes ago), 2023-01-12 22:28:25 -0500
        • Engine revision 99509a7e42
        • Dart version 3.0.0 (build 3.0.0-119.0.dev)
        • DevTools version 2.20.0
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  3. added
    a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: routesNavigator, Router, and related APIs.
    and removed
    in triagePresently being triaged by the triage team
    on Jan 13, 2023
  4. darshankawar commented on Jan 13, 2023

    @darshankawar
    Member
  5. added
    P2Important issues not at the top of the work list
    on Jan 17, 2023
  6. 2 remaining items

  7. added
    team-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)
    P1High-priority issues at the top of the work list
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    team-accessibilityOwned by Framework Accessibility team (i.e. responsible for accessibility code in flutter/flutter)
    on Sep 26, 2024
  8. Paulik8 commented on Jan 30, 2025

    @Paulik8
    Contributor

    Hello!
    I wanted to work on this issue but was pleased to find that it is no longer reproducible from the 3.27.2 version of Flutter!
    Most likely, the issue was resolved in the following pull request: #135771

    Could you please check if the issue is still relevant?

    fvm flutter doctor -v [✓] Flutter (Channel stable, 3.27.2, on macOS 14.7.2 23H311 darwin-arm64, locale en) • Flutter version 3.27.2 on channel stable at /Users/khotinp/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision 68415ad (2 weeks ago), 2025-01-13 10:22:03 -0800 • Engine revision e672b006cb • Dart version 3.6.1 • DevTools version 2.40.2

    [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    • Android SDK at /Users/khotinp/Library/Android/sdk
    • Platform android-35, build-tools 35.0.1
    • ANDROID_HOME = /Users/khotinp/Library/Android/sdk
    • Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
    • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

    [✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 2023.3)
    • 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 17.0.10+0-17.0.10b1087.21-11572160)

    [✓] IntelliJ IDEA Ultimate Edition (version 2022.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 77.1.1
    • Dart plugin version 223.8977

    [✓] IntelliJ IDEA Community Edition (version 2024.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 83.0.3
    • Dart plugin version 242.24931!

    cc @darshankawar @Piinks

  9. chunhtai commented on Jan 30, 2025

    @chunhtai
    Contributor

    yes, this should be fixed by that pr, closing this one

  10. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jan 31, 2025
  11. github-actions commented on Feb 14, 2025

    @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.

  12. locked as resolved and limited conversation to collaborators on Feb 14, 2025
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)f: routesNavigator, Router, and related APIs.found in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions