Repository navigation
SearchBar fails to show keyboard on Android after coming back from the background #134965
Copy link
Copy link
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.fyi-frameworkFor the attention of Framework teamFor the attention of Framework teamhas 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/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Click the SearchBar. They keyboard will come up
- Send the app to the background
- Come back from the background
- Click the SearchBar. The keyboard will not show
Extra info:
I tested on two Android devices. On my Pixel 2 running Android 11 everything worked fine. The problem happened on my Pixel 6 running Android 13
Expected results
When I come back from the background, I expect to see the keyboard again, or at least that it shows again if I click the SearchBar.
Actual results
I can't call the keyboard back
Code sample
Code sample
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const Scaffold(
body: Center(child: SearchBar()),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
https://drive.google.com/file/d/14rhlifS67w9rBBkJvMrqFUFonAoB8vOa/view?usp=sharing
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.4, on macOS 13.5.2 22G91 darwin-arm64
(Rosetta), locale en-BR)
[!] Android toolchain - develop for Android devices (Android SDK version
33.0.0-rc1)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2023.2.2)
[✓] VS Code (version 1.80.1)
[✓] Connected device (4 available)
[✓] Network resources
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.fyi-frameworkFor the attention of Framework teamFor the attention of Framework teamhas 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/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
danagbemava-nc commentedon Sep 19, 2023
Hi @AndreHaueisen, I'm curious, do you only experience this when you use the
gesture-basednavigation in android?AndreHaueisen commentedon Sep 19, 2023
Hey, @danagbemava-nc. No, it also happens when the 3-button navigation is active
huycozy commentedon Sep 20, 2023
@AndreHaueisen I checked this on my two devices (Realme 6 Android 11 and Pixel 4 Android 13) but can't reproduce the issue.
Can you re-check this with a simple
TextFieldwidget? Please also confirm if the issue is reproducible on a newly created Flutter project or only on the current project.AndreHaueisen commentedon Sep 20, 2023
@huycozy The problem is specific to
SearchBar.TextFieldworks as expected.I created a new project and tested it again. Same problem.
danagbemava-nc commentedon Sep 21, 2023
Thanks for the info @AndreHaueisen. Initially, I could not reproduce when I used the 3-button navigation. I tried again today and it could reproduce, however, in my case, this was not consistent. So far, this only reproduced on android for me.
screen-20230921-070610.mp4
complete sample
flutter doctor -v
9 remaining items
flutter-triage-bot commentedon Sep 21, 2023
The
triaged-androidlabel is irrelevant if there is noteam-androidlabel orfyi-androidlabel.Renzo-Olivares commentedon Nov 7, 2023
I'm able to reproduce this on the
masterbranch as well. I haven't been able to track down exactly why since it is a bit inconsistent but I think it has something to do with the fact that weactivatetheTextFieldby callingrequestFocuson itsFocusNoderather than interacting with the underlyingTextFieldthroughTextSelectionGestureDetector. I'm not able to reproduce this issue on my PR that enables text selection in the search bar #137636 . I'll try to write a regression test to confirm this is fixed.Fix text selection in `SearchAnchor/SearchBar` (#137636)
Renzo-Olivares commentedon Nov 10, 2023
This was closed by #137636 which has landed on the
masterbranch, if you are still experiencing this issue please feel free to re-open.github-actions commentedon Nov 27, 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 -vand a minimal reproduction of the issue.