Skip to content

Flutter form has issues with TextFormField getting focus when voiceover is on #120894

Open

Description

@mfdcoder

Please refer to the code at https://github.com/mfdcoder/flutter-form-voiceover

Steps to reproduce

  1. Switch on Voiceover
  2. Using Ctl + Option + Right arrow navigate to the TextFormField
  3. Continue navigating to 2nd, 3rd and 4th TextFormField
  4. Observe that voice over announces that "You are in a text field. To enter text in this field type".
  5. The input that has focus often does not accept what the user is typing
  6. The result is not consistent. The TextFormFields randomly get/don't get focus

The same can be reproduced on the flutter gallery demo app
https://gallery.flutter.dev/#/demo/text-field

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.0, on macOS 12.5 21G72 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.75.1)
[✓] Connected device (5 available)
[✓] HTTP Host Availability

SemanticsForm.mov

Activity

  1. darshankawar commented on Feb 17, 2023

    @darshankawar
    Member

    Thanks for the detailed report @mfdcoder
    Is the accessibility behavior only occuring on web ? Can you also check the same on mobile platforms (Android or iOS) and see if you still get same behavior or expected results ? That way we can narrow down to platform-specific behavior.

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 17, 2023
  3. mfdcoder commented on Feb 20, 2023

    @mfdcoder
    Author

    The behaviour is specific to web. Working as expected on iOS and Android

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 20, 2023
  5. huycozy commented on Feb 20, 2023

    @huycozy
    Member

    I can reproduce this issue on the latest stable and master channels with provided sample code. When using Ctl + Option + Right arrow to navigate to the next TextFormFields, the cursor won't focus on the field sometimes.

    But it seems to be related to focus traversal rather than TextFormField (see #118723). In case using combined keys to navigate between TextFormFields and it doesn't get focus, try going outside the Web and coming back, the focus ring will appear and the TextFormField is also focused.

    Screen.Recording.2023-02-20.at.11.32.30.mov

    Please try this test and confirm if you see the same behavior.

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 20, 2023
  7. mfdcoder commented on Feb 21, 2023

    @mfdcoder
    Author

    Yes- It works when try going outside the Web and coming back. But we need a solution in which user does not have to go out of the webpage

  8. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 21, 2023
  9. darshankawar commented on Feb 21, 2023

    @darshankawar
    Member

    Thanks for the update. Since this is replicable based on the verification done here, would be good to get web team's thoughts on the expected behavior.

    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.7.3, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.7.3 on channel stable 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 9944297138 (4 days ago), 2023-02-08 15:46:04 -0800
        • Engine revision 248290d6d5
        • Dart version 2.19.2
        • DevTools version 2.20.1
        • 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.
    
    [!] Flutter (Channel master, 3.8.0-14.0.pre.7, on macOS 12.2.1 21D62 darwin-x64,
        locale en-GB)
        • Flutter version 3.8.0-14.0.pre.7 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 e5619b9357 (6 hours ago), 2023-02-20 22:38:23 -0500
        • Engine revision 35aeeec58c
        • Dart version 3.0.0 (build 3.0.0-259.0.dev)
        • DevTools version 2.21.1
        • 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 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] 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.
    
    
    
    
  10. added
    a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)
    platform-webWeb applications specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: focusFocus traversal, gaining or losing focus
    and removed
    in triagePresently being triaged by the triage team
    on Feb 21, 2023
  11. added
    P2Important issues not at the top of the work list
    on Feb 23, 2023
  12. volodymyrparanytsia commented on Apr 18, 2024

    @volodymyrparanytsia

    I have the same issue on the most recent version of Flutter.

    The code I have issue with: import 'package:flutter/material.dart';

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

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

    class _MyAppState extends State {
    // This variable will store the text entered in the text field
    String _textFieldValue = "";

    @OverRide
    Widget build(BuildContext context) {
    return MaterialApp(
    home: Scaffold(
    appBar: AppBar(
    title: Text('Text Field and Button'),
    ),
    body: Center(
    child: Column(
    mainAxisAlignment: MainAxisAlignment.center,
    children: [
    TextField(
    decoration: InputDecoration(
    hintText: "Enter some text",
    ),
    onChanged: (value) {
    // Update the state variable with the entered text
    setState(() {
    print('TextField value -> $value');
    _textFieldValue = value;
    });
    },
    ),
    SizedBox(height: 20),
    ElevatedButton(
    onPressed: () {
    // Handle button press here (e.g., print the text)
    print("The entered text is: $_textFieldValue");
    },
    child: Text('Submit'),
    ),
    ],
    ),
    ),
    ),
    );
    }
    }

    flutter doctor -v

    [✓] Flutter (Channel stable, 3.19.4, on macOS 14.4.1 23E224 darwin-x64, locale en-GB)
    • Flutter version 3.19.4 on channel stable at /Users/vladimir.paranitsa/program_files/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68bfaea (4 weeks ago), 2024-03-20 15:36:31 -0700
    • Engine revision a5c24f5
    • Dart version 3.3.2
    • DevTools version 2.31.1

    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/vladimir.paranitsa/Library/Android/sdk
    • Platform android-34, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

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

    [✓] Android Studio (version 2023.1)
    • 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.7+0-17.0.7b1000.6-10550314)

    [✓] VS Code (version 1.88.1)
    • VS Code at /Users/vladimir.paranitsa/program_files/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

    [✓] Connected device (2 available)
    • macOS (desktop) • macos • darwin-x64 • macOS 14.4.1 23E224 darwin-x64
    • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.124

    [✓] Network resources
    • All expected network resources are available.

    • No issues found!

    I checked on next devices:
    Macbook 14.4.1 (23E224) Chrome(123.0.6312.123) and Safari(17.4.1) - can't enter anything from keyboard
    iPhone X(16.7) Chrome and Safari - VoiceOver pronounce letters I am trying to add and even read the result but the field itself empty
    Pixel 3a Chrome - TalkBack read letters trying to add, but the field itself is empty

  13. volodymyrparanytsia commented on Apr 19, 2024

    @volodymyrparanytsia

    UPD: I was checking issue locally and when I run build using this command:
    I see that there is an accessibility node which accept value filled in the field, however the textfield itself does not contain value. Looks like there is some issues with connection between accessibility node and the Text Field node.
    photo_5843689914498138421_y

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)a: text inputEntering text in a text field or keyboard related problemsf: focusFocus traversal, gaining or losing focusfound in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions