Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Desktop]: Cannot input space if TextField is inside ListTile. #90907

Closed
ugurozturk opened this issue Sep 28, 2021 · 11 comments · Fixed by #91129
Closed

[Desktop]: Cannot input space if TextField is inside ListTile. #90907

ugurozturk opened this issue Sep 28, 2021 · 11 comments · Fixed by #91129
Assignees
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. f: material design flutter/packages/flutter/material repository. found in release: 2.5 Found to occur in 2.5 found in release: 2.6 Found to occur in 2.6 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically platform-windows Building on or for Windows specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@ugurozturk
Copy link

ugurozturk commented Sep 28, 2021

Steps to Reproduce

  1. flutter create bug
  2. create TextField inside ListTile. Or Copy my main.dart
  3. Run on windows-x64
  4. Try to type "Test Typing wow"

Expected results:
"Test Typing wow"

Actual results:
"TestTypingwow"

import 'package:flutter/material.dart';

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


class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: const Center(
        child: ListTile(
              title: TextField(
                
              ),
            ),
      ),
    );
  }
}
[  +69 ms] executing: [D:\Setup\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +83 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] ffb2ecea5223acdd139a5039be2f9c796962833d
[        ] executing: [D:\Setup\flutter/] git tag --points-at ffb2ecea5223acdd139a5039be2f9c796962833d
[  +63 ms] Exit code 0 from: git tag --points-at ffb2ecea5223acdd139a5039be2f9c796962833d
[        ] 2.5.1
[   +9 ms] executing: [D:\Setup\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +61 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [D:\Setup\flutter/] git ls-remote --get-url origin
[  +54 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +130 ms] executing: [D:\Setup\flutter/] git rev-parse --abbrev-ref HEAD
[  +58 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +74 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +67 ms] executing: D:\Setup\Android\Sdk\platform-tools\adb.exe devices -l
[  +59 ms] List of devices attached
[   +9 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +7 ms] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +84 ms] Multiple devices found:
[  +35 ms] Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22000.194]
[   +2 ms] Chrome (web)      • chrome  • web-javascript • Google Chrome 94.0.4606.61
[   +1 ms] Edge (web)        • edge    • web-javascript • Microsoft Edge 94.0.992.31
[   +2 ms] [1]: Windows (windows)
[        ] [2]: Chrome (chrome)
[        ] [3]: Edge (edge)
[   +2 ms] Please choose one (To quit, press "q/Q")
[   +1 ms] : 
Analyzing bug...                                                        
No issues found! (ran in 2.3s)
[√] Flutter (Channel stable, 2.5.1, on Microsoft Windows [Version 10.0.22000.194], locale tr-TR)
    • Flutter version 2.5.1 at D:\Setup\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (11 days ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Sep 29, 2021
@darshankawar
Copy link
Member

darshankawar commented Sep 29, 2021

Thanks for the report. I see the same behavior and seems to be specific to desktop platform, as the same behavior occurs on macOS too, but works as expected on other platforms like mobile and web.

Verified on latest stable and master, running the code sample on Windows and macOS desktops, and we are unable to add space using spacebar while inputing text.

  1. Windows Desktop:

textfield

  1. macOS desktop:

Screenshot 2021-09-29 at 1 33 26 PM

  1. Mobile and web:
    Screenshot 2021-09-29 at 1 30 42 PM
flutter doctor -v

[√] Flutter (Channel master, 2.6.0-12.0.pre.135, on Microsoft Windows [Version 10.0.19042.1237], locale en-US)
    • Flutter version 2.6.0-12.0.pre.135 at D:\FlutterSDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3074c9e04b (3 hours ago), 2021-09-28 22:08:04 -0700
    • Engine revision bccb3a57eb
    • Dart version 2.15.0 (build 2.15.0-156.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\Win\AppData\Local\Android\sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.2)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31624.102
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.10+0-b96-7249189)

[√] VS Code (version 1.60.1)
    • VS Code at C:\Users\Win\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.1237]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 93.0.4577.82
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 93.0.961.52

• No issues found!

[√] Flutter (Channel stable, 2.5.1, on Microsoft Windows [Version 10.0.19042.1237], locale en-US)
    • Flutter version 2.5.1 at D:\FlutterSDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (4 days ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\Win\AppData\Local\Android\sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.2)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31624.102
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.10+0-b96-7249189)

[√] VS Code (version 1.60.1)
    • VS Code at C:\Users\Win\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (4 available)
    • SM A260G (mobile) • 5200763ebcfa861f • android-arm    • Android 8.1.0 (API 27)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Version 10.0.19042.1237]
    • Chrome (web)      • chrome           • web-javascript • Google Chrome 93.0.4577.82
    • Edge (web)        • edge             • web-javascript • Microsoft Edge 93.0.961.52

• No issues found!

@darshankawar darshankawar added a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems found in release: 2.5 Found to occur in 2.5 found in release: 2.6 Found to occur in 2.6 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-mac Building on or for macOS specifically platform-windows Building on or for Windows specifically engine flutter/engine repository. See also e: labels. and removed in triage Presently being triaged by the triage team labels Sep 29, 2021
@darshankawar darshankawar changed the title Windows x64 TextField inside ListTile can't type space [Desktop]: Cannot input space if TextField is inside ListTile. Sep 29, 2021
@HansMuller HansMuller added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Sep 29, 2021
@HansMuller
Copy link
Contributor

CC @justinmc

@justinmc
Copy link
Contributor

This is a regression caused by #80756 CC @dkwingsmt.

I could fix it by adding a DoNothingAndStopPropagationIntent for spaces on desktop, but that seems like a bandaid (here):

  SingleActivator(LogicalKeyboardKey.space): DoNothingAndStopPropagationTextIntent(),

Do we need to do some kind of check to only invoke the ActivateIntent if a field is not currently focused? Or any other way?

@justinmc justinmc added the c: regression It was better in the past than it is now label Sep 29, 2021
@dkwingsmt
Copy link
Contributor

dkwingsmt commented Sep 29, 2021

@justinmc Can you illustrate what of the change caused the regression?

@justinmc
Copy link
Contributor

@dkwingsmt If I comment out this line and run it on a Mac then the bug is gone:

SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),

Maybe there's some small difference between LogicalKeySet and SingleActivator?

@justinmc
Copy link
Contributor

Actually @LongCatIsLooong maybe your refactor #90684 will coincidentally fix this? Maybe then the Actions in the EditableText will receive the space before the ListTile does.

@LongCatIsLooong
Copy link
Contributor

LongCatIsLooong commented Sep 29, 2021

Actually @LongCatIsLooong maybe your refactor #90684 will coincidentally fix this? Maybe then the Actions in the EditableText will receive the space before the ListTile does.

If I'm understanding the issue correctly, that pull request does not change the current predefined shortcuts for text fields so it probably won't fix this issue.

I think this happens because TextFIeld doesn't override SingleActivator(LogicalKeyboardKey.space): ActivateIntent() and the ActivateIntent will end up being consumed by the ActivateIntent handler in the ink well. The enter key probably has this problem too.
We can override the shortcuts in EditableTextState but that will be the final override -- developers will lose the ability to further remap the space key to something else. We had a similar problem with Actions.

@gspencergoog gspencergoog added the P2 Important issues not at the top of the work list label Sep 30, 2021
@gspencergoog
Copy link
Contributor

cc @dkwingsmt

@justinmc
Copy link
Contributor

justinmc commented Oct 1, 2021

I just double checked my accusation of #80756 just to make sure, and I confirmed that the problem starts there, but I found that it's weirdly sporadic. When I checkout the merge commit b8833af, then the bug appears consistently like it does on master. When I checked out b8833af^ though, the bug can also still happen sometimes:

Screen.Recording.2021-10-01.at.3.58.18.PM.mov

@justinmc
Copy link
Contributor

justinmc commented Oct 2, 2021

I opened a proposal PR to get the discussion going on one way of fixing this: #91129

Please read the code and description and let me know what you think! If we decide to go this way then I'll write tests and move it out of draft mode.

@justinmc justinmc self-assigned this Oct 6, 2021
@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Oct 27, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. f: material design flutter/packages/flutter/material repository. found in release: 2.5 Found to occur in 2.5 found in release: 2.6 Found to occur in 2.6 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically platform-windows Building on or for Windows specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants