Skip to content

Keys (Tab, arrows) should not be handled by RenderEditable when also processed as an action. #47156

Closed

Description

@allComputableThings

In most UIs, TAB can be input to switch between input fields. This is necessary to enable accessible applications and also application that behave correctly with an external keyboard. This behavior doesn't typically ALSO input tab into the input field. In flutter tab performs both:

  • switch focus
  • input whitespace text into text fields.

If the first is done, the second should not.

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      title: 'My app', // used by the OS task switcher
      home: Material(child: content())));
}

Widget content() {
  var _focus1 = FocusNode();
  var _focus2 = FocusNode();

  return Column(
    children: [
      TextField(
        focusNode: _focus1,
        textInputAction: TextInputAction.next,
      ),
      TextField(
        focusNode: _focus2,
        textInputAction: TextInputAction.next,
      ),
    ],
  );
}

Is with the latest public flutter, Android emulator and Nexus 7 tablet VM.

flutter doctor -v
[✓] Flutter (Channel master, v1.13.3-pre.23, on Linux, locale en_US.UTF-8)
    • Flutter version 1.13.3-pre.23 at /home/sir/development/flutter
    • Framework revision c06bf6503a (3 days ago), 2019-12-13 17:42:35 -0500
    • Engine revision e0e0ac0a68
    • Dart version 2.8.0 (build 2.8.0-dev.0.0 45db297095)

 
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/sir/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /home/sir/Android/Sdk
    • Java binary at: /home/sir/soft/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /home/sir/soft/android-studio
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /snap/intellij-idea-ultimate/188
    • Flutter plugin version 42.1.4
    • Dart plugin version 193.5731

[✓] IntelliJ IDEA Ultimate Edition (version 2019.2)
    • IntelliJ at /snap/intellij-idea-ultimate/181
    • Flutter plugin version 41.1.4
    • Dart plugin version 192.7761

[✓] Connected device (3 available)
    • Android SDK built for x86 • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome                    • chrome        • web-javascript • Google Chrome 76.0.3809.132
    • Web Server                • web-server    • web-javascript • Flutter Tools

! Doctor found issues in 1 category.

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Dec 17, 2019
  2. HansMuller commented on Dec 17, 2019

    @HansMuller
    Contributor
  3. gspencergoog commented on Jan 15, 2020

    @gspencergoog
    Contributor

    In order to do this properly, we probably need to have #33521 implemented, since otherwise we can't have the Framework block insertion of a key because it is handling it as a focus signal (or any other shortcut).

  4. changed the title [-]Tab should not be added to textfield when also processed as a focus change.[/-] [+]Keys (Tab, arrows) should not be handled by RenderEditable when also processed as a focus change.[/+] on Jan 24, 2020
  5. gspencergoog commented on Jan 24, 2020

    @gspencergoog
    Contributor

    This doesn't just affect tab keys: it affects arrow keys too if you tell the DirectionalFocusIntent to not ignore text fields.

    Really, it affects any key bound to another action. The action should absorb the key, and it should never be delivered to the text field.

  6. changed the title [-]Keys (Tab, arrows) should not be handled by RenderEditable when also processed as a focus change.[/-] [+]Keys (Tab, arrows) should not be handled by RenderEditable when also processed as an action.[/+] on Jan 24, 2020
  7. added this to the April 2020 milestone on Jan 29, 2020
  8. self-assigned this
    on Jan 29, 2020
  9. 40 remaining items

  10. gspencergoog commented on Dec 14, 2020

    @gspencergoog
    Contributor

    @venkatd No, sorry, we probably can't expose those as new public methods: we'd have to support them going forward then, and that's not the API we want to end up with. As I said, this is one of the tasks we're currently working on, so hopefully it won't be too long.

  11. venkatd commented on Dec 14, 2020

    @venkatd

    @gspencergoog understood & thanks for sharing the reasoning

  12. Hixie commented on Jan 6, 2021

    @Hixie
    Contributor

    Update from @gspencergoog: macOS, Linux, and Android are all done, we're working on the Windows part at the moment.

  13. venkatd commented on Jan 6, 2021

    @venkatd

    Great! Was web already done? Or something for the future?

  14. ferhatb commented on Jan 13, 2021

    @ferhatb
    Contributor

    /cc @mdebbar - web

  15. justinmc commented on Jan 13, 2021

    @justinmc
    Contributor

    @vankatd This is my design doc for doing things like the arrow keys and tab keys via Shortcuts/Actions/Intents. I have a POC that has this working on Mac, and all the mapping is overridable, but it will depend on @gspencergoog's work for the full solution.

  16. gspencergoog commented on Jan 13, 2021

    @gspencergoog
    Contributor

    @venkatd @mdebbar I'm looking at web implementation in the next few days. It should be pretty simple to implement, I don't expect any issues.

  17. venkatd commented on Jan 13, 2021

    @venkatd

    We've got a flutter web prototype being used internally. It is designed to replace our React web app so we can share more code with our mobile Flutter app, but we need to iron out the rough edges before we can do a full swap.

    Our app is pretty text editing heavy. So anything related to text editing--and most importantly shortcuts/intent overrides--would have the highest impact on our customer experience.

    Great to hear it's got the teams focus!

  18. moradoronline commented on Jan 14, 2021

    @moradoronline

    In the web implementation seems to be working. In SImulators on Mac it have this weird behavior.

  19. Sunbreak commented on Jan 24, 2021

    @Sunbreak
    Contributor

    In the web implementation seems to be working. In SImulators on Mac it have this weird behavior.

    Maybe file another issue?

  20. github-actions commented on Aug 6, 2021

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

  21. locked as resolved and limited conversation to collaborators on Aug 6, 2021
  22. added
    P0Critical issues such as a build break or regression
    and removed on Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressiona: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemscustomer: soldierfound in release: 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packages

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions