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

[iOS][iPad]: Textfield not responding to CMD+C and CMD+V shortcuts using external keyboard #98832

Closed
nero-angela opened this issue Feb 20, 2022 · 11 comments · Fixed by flutter/engine#31691
Assignees
Labels
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 e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on P0 Critical issues such as a build break or regression platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version waiting for PR to land (fixed) A fix is in flight

Comments

@nero-angela
Copy link
Contributor

Copy (CMD + C) and paste (CMD + V) shortcuts do not work on iPad when using an external keyboard.
There were no problems with the iPhone.

Steps to Reproduce

  1. On the iPad, type on an external keyboard.
  2. Write text in TextField.
  3. Select an article and press CMD + C to copy it.
  4. Press CMD + V to paste.
sample code
import 'package:flutter/material.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: const [
            Padding(
              padding: EdgeInsets.all(8.0),
              child: TextField(),
            ),
          ],
        ),
      ),
    );
  }
}

flutter doctor -v
[✓] Flutter (Channel unknown, 2.11.0-0.0.pre.542, on macOS 12.0.1 21A559 darwin-x64, locale ko-KR)
    • Flutter version 2.11.0-0.0.pre.542 at /Users/nero/Project/FlutterContribution/flutter
    • Upstream repository unknown
    • Framework revision 1958656943 (6 days ago), 2022-02-14 05:15:17 -0500
    • Engine revision b63614c306
    • Dart version 2.17.0 (build 2.17.0-104.0.dev)
    • DevTools version 2.10.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nero/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Volumes/Lecture HD/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Volumes/Lecture HD/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 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] VS Code (version 1.63.2)
    • VS Code at /Volumes/Lecture HD/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (3 available)
    • nero의 iPad (mobile) • 00008027-000A41CE0C0A402E            • ios            • iOS 14.6 18F72
    • iPhone 13 (mobile)  • 2A06E0D7-FBAB-4FBD-AFA9-34FB720E1B61 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)        • chrome                               • web-javascript • Google Chrome 98.0.4758.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Feb 21, 2022
@darshankawar
Copy link
Member

Verified this behavior on latest master and stable using iPad Pro (4th gen) and observed that typing from external keyboard (e.g bluetooth) works, but copy paste isn't working, as shown below:

98832_i.mov

The same scenario works properly on iOS simulator whereing typing and copy paste seems to work as expected, as below:

98832_s.mov

When using cmd+c and cmd+v on simulator, the simulator displays a message on top of it CorSimulatorBridge pasted from {app name}`, but the same doesn't seem to trigger on iPad.

This behavior was fixed as part of this issue: #70104, PR : flutter/engine#28971 but seem to have come back.

stable, master flutter doctor -v

[✓] Flutter (Channel stable, 2.10.2, on Mac OS X 10.15.4 19E2269 darwin-x64,
    locale en-GB)
    • Flutter version 2.10.2 at /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (2 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[!] 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 (4 available)
    • iPhone 12 Pro Max (mobile)                     •
      A5473606-0213-4FD8-BA16-553433949729 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • iPad Pro (12.9-inch) (4th generation) (mobile) •
      AD9F1B85-B622-485E-97E8-E4AC866D5770 • 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.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.


[✓] Flutter (Channel master, 2.11.0-0.0.pre.633, on Mac OS X 10.15.4 19E2269
    darwin-x64, locale en-GB)
    • Flutter version 2.11.0-0.0.pre.633 at
      /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54a9d65282 (35 hours ago), 2022-02-19 10:09:26 -0800
    • Engine revision f6ea6186ee
    • Dart version 2.17.0 (build 2.17.0-125.0.dev)
    • DevTools version 2.11.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 (4 available)
    • iPhone 12 Pro Max (mobile)                     •
      A5473606-0213-4FD8-BA16-553433949729 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • iPad Pro (12.9-inch) (4th generation) (mobile) •
      AD9F1B85-B622-485E-97E8-E4AC866D5770 • 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.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.


Labeling it as a regression, since this was fixed but still occuring on latest versions.

/cc @jmagman

@darshankawar darshankawar added e: device-specific Only manifests on certain devices found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. c: regression It was better in the past than it is now and removed in triage Presently being triaged by the triage team labels Feb 21, 2022
@darshankawar darshankawar changed the title TextField shortcut issue when using external keyboard on iPad [iOS][iPad]: Textfield not responding to CMD+C and CMD+V shortcuts using external keyboard Feb 21, 2022
@chinmaygarde
Copy link
Member

Thanks @darshankawar for spotting the commits in the regression. Marking this a P2. cc @jmagman

@jmagman
Copy link
Member

jmagman commented Feb 23, 2022

@cyanglaz is looking at this.

@doppio
Copy link

doppio commented Feb 25, 2022

Is this likely the same issue as #68514? Supposedly PR: flutter/engine#28971 had fixed that as well, but I'm seeing it on stable. If this regression is unrelated, I can file another issue.

@red282
Copy link

red282 commented Feb 25, 2022

Is this likely the same issue as #68514? Supposedly PR: flutter/engine#28971 had fixed that as well, but I'm seeing it on stable. If this regression is unrelated, I can file another issue.

I'm seeing it (#68514) too on stable channel. It's not in 2.8.x, but seems to appear from 2.10.0.

@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 25, 2022

The issue is that https://github.com/flutter/engine/blob/main/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm#L1051 prevented the actions to go through, as when it is on iPad Pro, IsScribbleAvailable returns true.
This was introduced in: flutter/engine#24224 to support scribble handwriting.

A simple fix could be just allow actions like copy and paste passing through regardless of IsScribbleAvailable(). I don't understand how scribble works to be certain that this won't have other side effects, or break the scribble logic.

Maybe @justinmc, @gaaclarke, @LongCatIsLooong or @fbcouch can provide some advices?

@justinmc
Copy link
Contributor

Thanks for tracking that down @cyanglaz. I'll try a few solutions after my engine compiles.

@cyanglaz
Copy link
Contributor

@justinmc Great! Thanks, feel free to assign yourself if you plan to work on it :)

@justinmc
Copy link
Contributor

it looks like that NO was added because otherwise the paste notification shows up on every keypress ("[appname] pasted from ...").

I think I have a fix in flutter/engine#31691. Trying to get the tests working so I can write one...

@jmagman
Copy link
Member

jmagman commented Feb 28, 2022

Thank you @justinmc!

@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Mar 1, 2022
@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 Mar 15, 2022
@flutter-triage-bot flutter-triage-bot bot added P0 Critical issues such as a build break or regression and removed P2 labels Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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 e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on P0 Critical issues such as a build break or regression platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version waiting for PR to land (fixed) A fix is in flight
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants