Repository navigation
Keys (Tab, arrows) should not be handled by RenderEditable when also processed as an action. #47156
Copy link
Copy link
Closed
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressiona: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemscustomer: soldierfound in release: 1.21Found to occur in 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
Milestone
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressiona: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemscustomer: soldierfound in release: 1.21Found to occur in 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
Activity
HansMuller commentedon Dec 17, 2019
CC @gspencergoog
gspencergoog commentedon Jan 15, 2020
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).
[-]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.[/+]gspencergoog commentedon Jan 24, 2020
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.
[-]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.[/+]40 remaining items
gspencergoog commentedon Dec 14, 2020
@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.
venkatd commentedon Dec 14, 2020
@gspencergoog understood & thanks for sharing the reasoning
Hixie commentedon Jan 6, 2021
Update from @gspencergoog: macOS, Linux, and Android are all done, we're working on the Windows part at the moment.
venkatd commentedon Jan 6, 2021
Great! Was web already done? Or something for the future?
ferhatb commentedon Jan 13, 2021
/cc @mdebbar - web
justinmc commentedon Jan 13, 2021
@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.
gspencergoog commentedon Jan 13, 2021
@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.
venkatd commentedon Jan 13, 2021
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!
moradoronline commentedon Jan 14, 2021
In the web implementation seems to be working. In SImulators on Mac it have this weird behavior.
Sunbreak commentedon Jan 24, 2021
Maybe file another issue?
github-actions commentedon Aug 6, 2021
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 -vand a minimal reproduction of the issue.