Skip to content

Autocorrect highlight does not go away when screen is locked and unlocked #137666

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

Open
2 tasks done
jooikwanw opened this issue Nov 1, 2023 · 13 comments
Open
2 tasks done
Assignees
Labels
a: text input Entering text in a text field or keyboard related problems found in release: 3.13 Found to occur in 3.13 found in release: 3.16 Found to occur in 3.16 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-ios iOS applications specifically team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team

Comments

@jooikwanw
Copy link

jooikwanw commented Nov 1, 2023

Is there an existing issue for this?

Steps to reproduce

  1. Type something that will cause the text to be autocompleted ('Ji' for example)
  2. Turn off the mobile screen
  3. Turn on the screen again
  4. The blue box will be stuck on the screen

Expected results

Highlighting is supposed to disappear when moving to different screens/erasing the word.

Actual results

Probably related to #136837

When I type an incomplete word which will cause the word to be highlighted ("Ji for example"), it will be highlighted for autocomplete. I then turn off the phone screen and back on and the blue highlight box is stuck on the screen no matter what I do (clear the text box/move to a different screen)

Code sample

Code sample
class MyApp extends StatelessWidget {
  MyApp({super.key});
  final _formKey = GlobalKey<FormState>();

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: Scaffold(
          appBar: AppBar(
            title: Text('iOS 17 Issue'),
          ),
          body: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Container(
              child: Form(
                  key: _formKey,
                  child: Row(
                    children: [Expanded(child: TextFormField())],
                  )),
            ),
          ),
        ));
  }
}

Screenshots or Video

Screenshots / Video demonstration

Screenshot 2023-11-01 at 3 21 24 PM

Logs

Logs

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-arm64, locale en-SG)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
    ! Unknown CocoaPods version installed.
        Flutter is unable to determine the installed CocoaPods's version.
        Ensure that the output of 'pod --version' contains only digits and . to be recognized by Flutter.
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Community Edition (version 2022.3.2)
[✓] VS Code (version 1.82.0)
[✓] Connected device (4 available)
[✓] Network resources
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Nov 1, 2023
@danagbemava-nc danagbemava-nc changed the title Autocomplete highlighting not going away on screen change/text field clear Autocomplete highlight does not go away when screen is locked and unlocked Nov 1, 2023
@danagbemava-nc
Copy link
Member

Reproducible on the latest stable and master using the steps outlined above.

updated sample
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.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: Scaffold(
        appBar: AppBar(),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: TextFormField(),
        ),
      ),
    );
  }
}
flutter doctor -v
[!] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-GB)
    • Flutter version 3.13.9 on channel stable at /Users/nexus/dev/sdks/flutter
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (7 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0
    • 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.1)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Users/nexus/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode-15.0.0-Release.Candidate.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

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

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nexus/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 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.3)
    • IntelliJ at /Users/nexus/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 76.0.4
    • Dart plugin version 232.10072.19

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

[✓] Connected device (4 available)
    • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 17.1 21B74
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 17.1 21B74
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 118.0.5993.117

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 3.16.0-20.0.pre.34, on macOS 14.0 23A344 darwin-arm64, locale en-GB)
    • Flutter version 3.16.0-20.0.pre.34 on channel master at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5022d284a1 (5 hours ago), 2023-11-01 01:03:57 -0400
    • Engine revision 5ef5e6da90
    • Dart version 3.3.0 (build 3.3.0-84.0.dev)
    • DevTools version 2.28.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Users/nexus/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode-15.0.0-Release.Candidate.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

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

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nexus/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 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.3)
    • IntelliJ at /Users/nexus/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 76.0.4
    • Dart plugin version 232.10072.19

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

[✓] Connected device (4 available)
    • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 17.1 21B74
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 17.1 21B74
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 118.0.5993.117

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@danagbemava-nc danagbemava-nc added a: text input Entering text in a text field or keyboard related problems platform-ios iOS applications specifically has reproducible steps The issue has been confirmed reproducible and is ready to work on team-ios Owned by iOS platform team found in release: 3.13 Found to occur in 3.13 found in release: 3.16 Found to occur in 3.16 and removed in triage Presently being triaged by the triage team labels Nov 1, 2023
@vashworth
Copy link
Contributor

@hellohuanlin Can you take a look at this and see if it's an iOS or framework issue?

@vashworth vashworth added P2 Important issues not at the top of the work list triaged-ios Triaged by iOS platform team labels Nov 6, 2023
@rocketnik
Copy link

The issue also happens on iPhones with notch, if during suggestion highlighting the app is switched via swiping on the bottom of the screen to the side.

Tested on 3.13.7
Might be related to #128406

@hellohuanlin
Copy link
Contributor

@jooikwanw can you clarify which specific iOS version are you using (major and minor version as iOS 17 and 17.1 behaves differently)

@jooikwanw
Copy link
Author

@hellohuanlin iOS 17.0.3

@verhneudinec

This comment was marked as duplicate.

@jooikwanw

This comment was marked as duplicate.

@jmagman jmagman added the fyi-text-input For the attention of Text Input team label Mar 12, 2024
@justinmc justinmc changed the title Autocomplete highlight does not go away when screen is locked and unlocked Autocorrect highlight does not go away when screen is locked and unlocked Apr 11, 2024
@justinmc
Copy link
Contributor

I tried to reproduce this on 17.0 and 17.4 simulators, and I could only see it on 17.4, interestingly.

CC @LongCatIsLooong (who's currently on vacation for a month)

@justinmc justinmc added triaged-text-input Triaged by Text Input team and removed fyi-text-input For the attention of Text Input team labels Apr 11, 2024
@flutter-triage-bot flutter-triage-bot bot removed the triaged-text-input Triaged by Text Input team label Apr 11, 2024
@flutter-triage-bot
Copy link

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

@Priyankkjain

This comment was marked as duplicate.

@justinmc justinmc added team-text-input Owned by Text Input team and removed team-ios Owned by iOS platform team labels May 15, 2024
@justinmc justinmc added fyi-ios For the attention of iOS platform team triaged-text-input Triaged by Text Input team and removed triaged-ios Triaged by iOS platform team labels May 15, 2024
@jmagman jmagman added the triaged-ios Triaged by iOS platform team label Aug 28, 2024
@flutter-triage-bot flutter-triage-bot bot removed fyi-ios For the attention of iOS platform team triaged-ios Triaged by iOS platform team labels Aug 28, 2024
@flutter-triage-bot flutter-triage-bot bot added the Bot is counting down the days until it unassigns the issue label Jan 1, 2025
@flutter-triage-bot
Copy link

This issue is assigned to @LongCatIsLooong but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

@flutter-triage-bot flutter-triage-bot bot removed the triaged-text-input Triaged by Text Input team label Mar 20, 2025
@flutter-triage-bot
Copy link

This issue was assigned to @LongCatIsLooong but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.

@flutter-triage-bot flutter-triage-bot bot removed the Bot is counting down the days until it unassigns the issue label Mar 20, 2025
@justinmc justinmc added the triaged-text-input Triaged by Text Input team label Apr 3, 2025
@LongCatIsLooong
Copy link
Contributor

LongCatIsLooong commented May 6, 2025

This looks like an UIKit bug. There's no API to "dismiss" the autocorrect highlight, as it's managed by UIKit. The relevant stack trace I got in my test UIKit app:

  * frame #0: 0x000000018527aa18 UIKitCore`-[_UIKeyboardStateManager removeTextChoicePrompt] + 4
    frame #1: 0x000000018527a950 UIKitCore`-[_UIKeyboardStateManager removeAutocorrectPromptAndCandidateList] + 40
    frame #2: 0x00000001859c02f8 UIKitCore`-[UIKeyboardImpl clearLayouts] + 164
    frame #3: 0x00000001859bd218 UIKitCore`+[UIKeyboardImpl releaseSharedInstance] + 100
    frame #4: 0x0000000185be143c UIKitCore`-[UIApplication _purgeSharedInstances] + 20
    frame #5: 0x00000001851d5494 UIKitCore`__101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_5 + 148
    frame #6: 0x00000001851d53d8 UIKitCore`__101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_4 + 284
    frame #7: 0x000000018500e224 UIKitCore`-[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 396
    frame #8: 0x000000018500f03c UIKitCore`-[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220
    frame #9: 0x0000000185692624 UIKitCore`-[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 308
    frame #10: 0x0000000187bfc5bc FrontBoardServices`__76-[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.112 + 224
    frame #11: 0x0000000187bfb3fc FrontBoardServices`-[FBSScene _callOutQueue_coalesceClientSettingsUpdates:] + 60
    frame #12: 0x0000000187bfc300 FrontBoardServices`-[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 660
    frame #13: 0x0000000187c22df4 FrontBoardServices`__94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 120
    frame #14: 0x0000000187c06c18 FrontBoardServices`-[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 160
    frame #15: 0x0000000187c5f728 FrontBoardServices`__94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke.cold.1 + 228
    frame #16: 0x0000000187c22d64 FrontBoardServices`__94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 160
    frame #17: 0x0000000105375798 libdispatch.dylib`_dispatch_client_callout + 12
    frame #18: 0x000000010535fd0c libdispatch.dylib`_dispatch_block_invoke_direct + 388
    frame #19: 0x0000000187c3dfb8 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 44

but -[_UIKeyboardStateManager removeTextChoicePrompt] doesn't get called in a Flutter app. I suspect that's because it's only implemented for UIScene based apps since a large part of the stack trace are UIScene methods. There's ongoing work for that and let's see if that is going to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems found in release: 3.13 Found to occur in 3.13 found in release: 3.16 Found to occur in 3.16 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-ios iOS applications specifically team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team
Projects
None yet
Development

No branches or pull requests

10 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy