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

Embedded Android views can't bring up the keyboard #19718

Closed
amirh opened this issue Jul 24, 2018 · 184 comments
Closed

Embedded Android views can't bring up the keyboard #19718

amirh opened this issue Jul 24, 2018 · 184 comments

Comments

@amirh
Copy link
Contributor

@amirh amirh commented Jul 24, 2018

To make sure that Flutter can always bring up the keyboard I made the window of virtual display's presentation non focusable.
As a result the embedded Android views cannot bring up the keyboard.

We should figure out if there's some window trickery we can do to let the unfocused window bring up the keyboard. Alternatively see if it's possible to dynamically select the focused window when delivering input events.

@fujinjun
Copy link

@fujinjun fujinjun commented Dec 5, 2018

anyone solved this problem?

Loading

@bvedam
Copy link

@bvedam bvedam commented Jan 16, 2019

Still seeing the issue on the following versions. Surprised to see this issue is still not resolved after 6 months.

compileSdkVersion = targetSdkVersion = 26 & 27

Tried both stable and beta channels.

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.0.0, on Microsoft Windows [Version 10.0.16299.847], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.2)
[√] VS Code, 64-bit edition (version 1.30.2)
[√] Connected device (1 available)

• No issues found!

Can someone respond with the status please. Thanks.

Loading

@amirh
Copy link
Contributor Author

@amirh amirh commented Jan 16, 2019

Since as far as I can tell there isn't a way for an Android app to dynamically change the focused window, and as only the focused window can bring up and use a keyboard, the only approach I see right now is to setup up some proxying mechanism for input connections which isn't trivial on it's own as non trivial trickery is required to figure out when a webview is asking for keyboard. Last I dug into this I had a somewhat complex plan which I haven't tested yet (if someone have a suggestion for a clean solution I'd be very happy to hear about it).

An alternative approach would be to use an iOS style platform view embedding mechanism when keyboard is needed (splitting the Flutter surface instead of rendering to a texture), this will have the drawback of not supporting all transforms (e.g if you'll opt in for keyboard support you will trade things like color filters, backdrop filter, perspective transforms and more).

All this to say that this is a non trivial effort, I do think it is important and will try to get it, but right now I'm focusing on finalizing and quality of the current set of platform views features.

Loading

@bvedam
Copy link

@bvedam bvedam commented Jan 17, 2019

Thank you very much for detailing the problem in hand, and its complexity. Currently using flutter_inappbrowser plugin based that is based on AndroidView, which is why I have this problem. I initially used the flutter community plugin "flutter_webview_plugin" but that doesn't support setting cookies (inappbrowser does). Is there a web view plugin you could recommend that supports setting webview cookies and not have this keyboard issue. Appreciate your response.

Loading

@amirh
Copy link
Contributor Author

@amirh amirh commented Jan 18, 2019

I have no experience with webview plugins other than webview_flutter, you might have a better luck asking in one of the community channels: https://flutter.io/community

Loading

@Steve-sy
Copy link

@Steve-sy Steve-sy commented Feb 7, 2019

Hello Guys, anyone solved this issue?

Loading

@alexelisenko
Copy link

@alexelisenko alexelisenko commented Feb 11, 2019

Having the same issue with webview_flutter: ^0.3.0+2 on Android. Does anyone have any workarounds?

Loading

@Steve-sy
Copy link

@Steve-sy Steve-sy commented Feb 11, 2019

Having the same issue with webview_flutter: ^0.3.0+2 on Android. Does anyone have any workarounds?

its really shame on flutter man! look at the issue its from Jul 24, 2018! @amirh any news can help us bro?

Loading

@Hixie
Copy link
Member

@Hixie Hixie commented Feb 13, 2019

@Steve-sy Please consider reading through https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md at some point soon. Thanks! :-)

Loading

@ghost
Copy link

@ghost ghost commented Feb 15, 2019

In my app, when the WebView is showing, that is the only place there will ever be a need for a keyboard. In this scenario, the WebView is shown in full screen with a floating button to access settings and exit WebView.

This plugin is great compared to the others I've tried but I really need that keyboard on Android. My app also has components written in Flutter, with many more to be added soon, but because we have a web login, we can't get very far (literally nowhere) in our app without a keyboard!

Could we do something like a FullScreenWebView that DOES allow the window of virtual display's presentation to be focusable?

Thanks

Loading

@qiaolin-pan
Copy link

@qiaolin-pan qiaolin-pan commented Jul 16, 2019

[android] How to dismiss the keyboard after clicking outside TextField/anywhere on screen?

Loading

@masewo
Copy link

@masewo masewo commented Jul 18, 2019

With version 0.3.10+3 of webview_flutter plugin and flutter on master channel it is now not possible anymore to copy and paste text from clipboard to input fields (tested on multiple Android 9 devices including emulator). Happens on multiple websites and also in the webview_flutter example app.

Loading

@mklim
Copy link
Member

@mklim mklim commented Jul 18, 2019

@pakyo-pan filed #36478 to track this, thanks.
@masewo thanks for the detailed info. That's currently being tracked in #24585.

Loading

@joelbrostrom
Copy link

@joelbrostrom joelbrostrom commented Aug 9, 2019

@masewo
I noticed the same thing.
I can add that double clicking text highlights it and brings up the option bar above it.
Pressing any one of cut/copy/paste closes the option bar and deselect the text but does not perform the action.

This is an important feature for any "look up" application.
Fix would be appreciated.

Just open google in a WebView to try it out:

import 'package:blk_birthday_flutter/utility/const.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(
      MaterialApp(
        theme: appTheme,
        title: 'Birthday',
        home: Scaffold(
          body: WebView(
            initialUrl: 'https://google.com',
          ),
        ),
      ),
    );

Loading

@luffynas
Copy link

@luffynas luffynas commented Aug 17, 2019

yeach, this issue still occurs, please read this #38668 (comment)

Loading

@jameszhao-io
Copy link

@jameszhao-io jameszhao-io commented Aug 17, 2019

After upgrading to webview_flutter 0.3.13 and Flutter 1.7.8 hotfix 4 stable, I can input text in normal textfield. But I still cannot input in password textfield. Could you please fix it? @amirh

Loading

@pythoneer
Copy link

@pythoneer pythoneer commented Aug 18, 2019

@jameszhao-io can you please file a new issue, this one is closed!

Loading

@sldboy
Copy link

@sldboy sldboy commented Aug 23, 2019

After upgrading to webview_flutter 0.3.13 and Flutter 1.7.8 hotfix 3 stable, I can input text in normal textfield. But I still cannot input in password textfield. me too.@jameszhao-io

Loading

@amirh
Copy link
Contributor Author

@amirh amirh commented Sep 10, 2019

@sldboy thanks for the report, do you mind filing a separate issue for password fields?

Loading

@marclester-tang
Copy link

@marclester-tang marclester-tang commented Sep 16, 2019

This issue still persists in android 10

Loading

@pythoneer
Copy link

@pythoneer pythoneer commented Sep 16, 2019

@marclester-tang what do you mean? Is there a regression that makes the issue reoccur on Android 10? I can't really tell what "still" means in this context, because the issue was solved thus it can't be "still" there. Or do you want us to know that the problem was never solved on your environment? What version of Flutter do you have? Regardless of your particular case it is the best idea if you file a new issue with your specific problem because it looks like the issue was solved for the majority of the people involved.

Loading

@mklim
Copy link
Member

@mklim mklim commented Sep 16, 2019

@marclester-tang @pythoneer sounds like issue #38375.

Loading

@smurfxx
Copy link

@smurfxx smurfxx commented Nov 20, 2019

I can confirm that the keyboard issue is still present on Android 10, I tested on a Pixel 3a and the keyboard never appears when focusing an input text field of the web pages.

Loading

@mklim
Copy link
Member

@mklim mklim commented Nov 20, 2019

@smurfxx thanks for the report. Could you please file a new issue for this with flutter doctor if you're seeing this on a recent version of Flutter? So far it sounds like #38375. That has been fixed upstream but currently the fix still hasn't rolled into stable.

Loading

@ChrisFetterly
Copy link

@ChrisFetterly ChrisFetterly commented Feb 2, 2020

Same issues today with keyboard. Can focus the input field within the WebViews but the keyboard does not populate the field. We tried on both a nexus and a Huawei mate 9 pro.

Loading

@mklim
Copy link
Member

@mklim mklim commented Feb 3, 2020

@ChrisFetterly thanks for the report. Could you file a new issue for the problem you're seeing with the output of flutter doctor and a small reproducible sample case?

Loading

@hnvn
Copy link

@hnvn hnvn commented May 6, 2020

Hi guys, I am facing a problem with keyboard in Android that it overlaps input fields when it shows up. Is there anyone know this issue?

Loading

@jtibbles
Copy link

@jtibbles jtibbles commented May 12, 2020

On Android it doesn't seem to work if you click inside the textfield, it only works if you click on the top border of the textfield. Then the keyboard pops up.
And if you click anywhere else the keyboard remains on-screen.

Loading

@veselinnguyen
Copy link

@veselinnguyen veselinnguyen commented Jun 25, 2020

Hi guys,
The issue still occurs and it has been here for ages. Noone has found already a solution?

I am opening a WEBPAGE in a FLUTTER WEBVIEW. The Keyboard works only for ANDROID.

Screenshot 2020-06-23 at 11 13 10 PM

Loading

@crypto-maria
Copy link

@crypto-maria crypto-maria commented Sep 5, 2020

Hi guys,
The issue still occurs and it has been here for ages. Noone has found already a solution?

I am opening a WEBPAGE in a FLUTTER WEBVIEW. The Keyboard works only for ANDROID.

Screenshot 2020-06-23 at 11 13 10 PM

Have you got any solution for this?

Loading

@matuella
Copy link

@matuella matuella commented Oct 7, 2020

Hi guys,
The issue still occurs and it has been here for ages. Noone has found already a solution?

I am opening a WEBPAGE in a FLUTTER WEBVIEW. The Keyboard works only for ANDROID.

Screenshot 2020-06-23 at 11 13 10 PM

are you sure you haven't disabled the simulator visual keyboard (CMD + K / SHIFT + CMD + K)?

Loading

@crypto-maria
Copy link

@crypto-maria crypto-maria commented Oct 7, 2020

Loading

@github-actions
Copy link

@github-actions github-actions bot commented Aug 11, 2021

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.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.