-
Notifications
You must be signed in to change notification settings - Fork 343
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
[QUESTION] How to handle focus? #47
Comments
Controller unfocus should work with However, if you are trying to create an implementation where you can, for example, jump from a With time hopefully this can be sorted out but as of right now it is still an issue. A quick search reveals this issue on |
yeah, I was quite frustrated with this too. In my case, I've a TextFormField and a HTML editor together in my widget. There are three issues I've seen so far,
|
@anamak9 would you be able to provide device details and a video/reproducible example for the above?
Judging by this you are using the Simulator on macOS, this is a known issue with the simulator - the hardware keyboard doesn't work to type in any webview, not just this package. It works fine on a real iOS device or Safari afaik. |
@tneotia I may not able to produce a video for now but why don't you try to create a widget just like the one I did and run it on an emulator and see yourself (I had used an android emulator)? |
@anamak9 finally got a chance to test on an emulator. I can't reproduce your 2nd and 3rd issues at all on the Android.SR.-.html_editor_enhanced.mp4 |
Added in v2.2.0, thanks for the suggestion! (Use |
@tneotia - I will test it again and let you know. |
Is there any progress on resolving this problem?
|
Unfortunately no, this is pretty much a Flutter limitation due to how it works with platform views (in this case webview). |
Same here. It is quite common to have, let's say, a TextField for Subject and the Html Editor for the Body of the message. Because of this, it's not possible to correctly move focus from the TextField to the Html Editor. Any hint? |
When I click menu list options, focus will land on the edit box, cause I can't choose. How do I solve this problem |
Any update on this? setFocus function is not working so it is not possible to autofocus the editor which is a big issue I think... |
Unfortunately no, this is still a Flutter limitation with platform views. I've messed with the setFocus on numerous occasions and I don't think that propagates outside the webview (ie it doesn't tell Flutter that an element in the webview is focused, and should open the keyboard) |
@tneotia have you reported this to the flutter_inappwebview team? Have you tried to use another webview plugin instead of flutter_inappwebview? |
@tneotia Sorry I see that you did try. |
All webview plugins have the same issues, and by far flutter_inappwebview is better than the rest so I chose it. Until Flutter team improves platform view functionality, nothing can be done here (and it is a P4 issue so not high priority at this time) |
Just to let you know, a possible solution is to update the onFocus function in the editor like this. It works for the web, I did n t test for mobile: onFocus: () { |
Yes I have also the problem that when I have a alertDialog that overlap the editor, the mouse still change to a cursor and when I click on my dialog the focus go to my editor that is behind it. |
If you need to dismiss the keyboard try this:
|
this worked for me to keep the focus in the HTMLEditor: callbacks: Callbacks( |
It worked for me. |
Hi,
I have a question regarding the focus of the editor. I couldn't figure out how to handle it, especially how to request or unfocus it programmaticaly. I tried
controller.setFocus()
andcontroller.clearFocus()
but both did not seem to work.Another question: Is it possible to define the keyboard type ?
The text was updated successfully, but these errors were encountered: