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]When the keyboard type of the TextField is set to "numer", there is an issue of repeated characters with certain IME. #133424

Closed
2 tasks done
abgne opened this issue Aug 28, 2023 · 7 comments · Fixed by flutter/engine#45657
Assignees
Labels
a: internationalization Supporting other languages or locales. (aka i18n) a: tablet Tablets and landscape phones 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. framework flutter/packages/flutter repository. See also f: labels. P1 High-priority issues at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-design Owned by Design Languages team

Comments

@abgne
Copy link

abgne commented Aug 28, 2023

Is there an existing issue for this?

Steps to reproduce

  1. Use the sample program I've provided.
  2. Add the Japanese IME to the keyboard on the actual iPad device.(Chinese, Traditional - Zhuyin has the same issue)
  3. Execute the sample program on the actual iPad device.
  4. Ensure the input box remains blank.
  5. Switch to the Japanese input method.
  6. Try pressing only the number key "1".

Expected results

I expect only a single "1".

Actual results

However, in addition to the number key "1" that we pressed, an additional "1" will automatically appear.

Code sample

Code sample

main.dart

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.amber,
          title: const Text('Flutter Demo'),
        ),
        body: const Padding(
          padding: EdgeInsets.all(8.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('keyboardType: TextInputType.number'),
              TextField(
                keyboardType: TextInputType.number, // the same: TextInputType.phone
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

The issue occurs only on the actual iPad device; the simulator works normally.

RPReplay_Final1693185994.MP4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel stable, 3.13.1, on macOS 13.1 22C65 darwin-x64, locale zh-Hant-TW)
    • Flutter version 3.13.1 on channel stable at /Users/user/Development/flutter
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/3.1.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
      /Users/user/Development/flutter. Consider adding /Users/user/Development/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e1e47221e8 (5 天前), 2023-08-22 21:43:18 -0700
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0
    • Pub download mirror https://pub.dev
    • Flutter download mirror https://storage.googleapis.com
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/user/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Android Studio (version 2022.2)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)

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

[✓] Connected device (3 available)
    • iPad Pro (mobile)       • 00008020-000658D602F9002E            • ios            • iOS 16.2 20C65
    • macOS (desktop)              • macos                                • darwin-x64     • macOS 13.1 22C65 darwin-x64
    • Chrome (web)                 • chrome                               • web-javascript • Google Chrome 116.0.5845.110

[✓] Network resources
    • All expected network resources are available.
@huycozy huycozy added the in triage Presently being triaged by the triage team label Aug 28, 2023
@huycozy
Copy link
Member

huycozy commented Aug 28, 2023

Hi @abgne
I don't have a physical iPad to check this (it seems the issue is only reproducible on iPad with that keyboard layout). It doesn't happen on an emulator/simulator as you stated.

Could you please confirm this issue is only reproduced with number/phone keyboard type? It doesn't occur with another type (text/url/..), right?

Also, please switch to master channel and confirm if this issue still persists. Thank you!

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 28, 2023
@abgne
Copy link
Author

abgne commented Aug 29, 2023

Hi @huycozy

Thank you for your response!

When the keyboard type is set to 'number', only the numeric keypad appears on the phone and cannot be switched. However, this is not the case on the Pad. Moreover, I don't have any physical Android Pad, so I'm uncertain whether this issue exists on Android Pad.

Testing on iPhone

The test shown in the image below was conducted on my actual iPhone device.

IMG_9185

After switching to the main branch, the issue still persists.

[!] Flutter (Channel master, 3.14.0-12.0.pre.72, on macOS 13.1 22C65 darwin-x64, locale zh-Hant-TW)
    • Flutter version 3.14.0-12.0.pre.72 on channel master at /Users/user/Development/flutter
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/3.1.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
      /Users/user/Development/flutter. Consider adding /Users/user/Development/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 42e2f4fb3e (53 分鐘前), 2023-08-28 19:43:58 -0400
    • Engine revision bd2132a081
    • Dart version 3.2.0 (build 3.2.0-114.0.dev)
    • DevTools version 2.26.2
    • Pub download mirror https://pub.dev
    • Flutter download mirror https://storage.googleapis.com
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
(base) ➜  input_bug flutter --version
Flutter 3.14.0-12.0.pre.72 • channel master • https://github.com/flutter/flutter.git
Framework • revision 42e2f4fb3e (2 小時前) • 2023-08-28 19:43:58 -0400
Engine • revision bd2132a081
Tools • Dart 3.2.0 (build 3.2.0-114.0.dev) • DevTools 2.26.2

The APP shown in the following video was tested using the master version.

3.14.0-12.0.pre.72.MP4

I've tested all 11 types of TextInputType. Only number/phone have issues, mainly because they switch to the numeric keypad (when toggling within the last used IME).

Test video for the 11 types.
TextInputType.MP4

I've tested and found it working correctly in version 3.7.x. However, subsequent versions from 3.10.x to the latest have issues.

If there are any tests that can help you pinpoint the issue, please let me know!

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 29, 2023
@huycozy
Copy link
Member

huycozy commented Aug 29, 2023

Thanks for the detailed tests.

I also checked this on Android tablet emulator and other platforms (macOS, web) but can't see the issue. It also can't reproduce on an Android physical phone (since the keyboard layout can't be changed for language; same to iPhone)

Labeling this as an iOS platform-specific issue. If anyone facing this issue can reproduce it on an Android physical tablet, please write in the comments. Thanks!

@huycozy huycozy added a: text input Entering text in a text field or keyboard related problems platform-ios iOS applications specifically framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine repository. See also e: labels. a: tablet Tablets and landscape phones a: internationalization Supporting other languages or locales. (aka i18n) team-ios Owned by iOS platform team and removed in triage Presently being triaged by the triage team labels Aug 29, 2023
@justinmc justinmc added the c: regression It was better in the past than it is now label Aug 31, 2023
@LongCatIsLooong LongCatIsLooong self-assigned this Sep 7, 2023
@LongCatIsLooong LongCatIsLooong added P2 Important issues not at the top of the work list triaged-design Triaged by Design Languages team labels Sep 7, 2023
@flutter-triage-bot flutter-triage-bot bot removed the triaged-design Triaged by Design Languages team label Sep 7, 2023
@flutter-triage-bot
Copy link

The triaged-design label is irrelevant if there is no team-design label or fyi-design label.

@LongCatIsLooong LongCatIsLooong added team-design Owned by Design Languages team triaged-design Triaged by Design Languages team labels Sep 8, 2023
@flutter-triage-bot flutter-triage-bot bot removed team-design Owned by Design Languages team triaged-design Triaged by Design Languages team labels Sep 8, 2023
@flutter-triage-bot
Copy link

Issue is assigned to multiple teams (design, ios). Please ensure the issue has only one team-* label at a time. Use fyi-* labels to have another team look at the issue without reassigning it.

@flutter-triage-bot flutter-triage-bot bot removed the team-ios Owned by iOS platform team label Sep 8, 2023
@LongCatIsLooong
Copy link
Contributor

This is reproducible on simulators. The iPad system Japanese keyboard is a bit different from that on iPhones and so far I'm not able to reproduce the issue on an iPhone.

@LongCatIsLooong LongCatIsLooong added P1 High-priority issues at the top of the work list and removed P2 Important issues not at the top of the work list labels Sep 10, 2023
@huycozy huycozy added the team-design Owned by Design Languages team label Sep 11, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue Sep 18, 2023
Fixes flutter/flutter#133424

The `-[TextInputDelegate selectionDidChange:]` call actually triggers some unwanted keyboard NLP actions that generate a bunch of candidates and automatically accept the first candidate. This causes `-[UITextInput setMarkedText:selection]` to be called with the first candidate and that inserts extraneous characters after the user types certain characters on the iPad software keyboard.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@huycozy huycozy added the r: fixed Issue is closed as already fixed in a newer version label Sep 19, 2023
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

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 Oct 3, 2023
harryterkelsen pushed a commit to flutter/engine that referenced this issue Oct 23, 2023
Fixes flutter/flutter#133424

The `-[TextInputDelegate selectionDidChange:]` call actually triggers some unwanted keyboard NLP actions that generate a bunch of candidates and automatically accept the first candidate. This causes `-[UITextInput setMarkedText:selection]` to be called with the first candidate and that inserts extraneous characters after the user types certain characters on the iPad software keyboard.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: internationalization Supporting other languages or locales. (aka i18n) a: tablet Tablets and landscape phones 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. framework flutter/packages/flutter repository. See also f: labels. P1 High-priority issues at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-design Owned by Design Languages team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants