Open carlos-ferreira opened 5 years ago
Any resolution on this? I am also facing the same issue.
Hi Team,
Is there any updates on this ? Its a showstopper in our development works so please get rid of this issue ASAP.
@dillibabun please submit a pull request ASAP. This issue is very very important!
@ahmedalejo Even we are looking for the issue fix from Xamarin team and our development work stopped due to this issue.
I tried to do some investigation to understand why this happened and i found out why.
On Xamarin.Forms.Platform.iOS the PageRenderer adds a UITapGestureRecognizer:
This is what is causing the blur on the webview and closing the keyboard.
A workaround for this would be creating a custom page renderer for the page that is using the webview, override the ViewDidLoad method and remove the Gesture Recognizer:
public override void ViewDidLoad()
{
base.ViewDidLoad();
this.NativeView.RemoveGestureRecognizer(this.NativeView.GestureRecognizers.First());
}
This way, when a button is pressed, the keyboard isn't dismissed and the focus isn't lost.
The true question now is, is this really a bug @samhouts ? Why does Xamarin.Forms add this Gesture Recognizer ?
Hi,
I faced this issue now as well and after some investigation you find a lot of examples of people having a similar issue. Often it is about some text entry field losing the focus when another button on the page is pressed. The proposed solutions for those issues were always some dirty hacks. Hence I would assume that the root cause of this issue also affects those cases with the entry fields.
So the question remains why this gesture recognizer is added and what purpose it serves. Can anybody answer this, e.g. @samhouts?
As the native behaviour is clearly different I assume a fix would be necessary, right? Thanks in advance to anybody taking care of it.
Description
When we tap on a button with selected text on a webview, the keyboard closes and the text looses the selection.
It's working perfectly on Android but not on iOS.
This behavior doesn't happen by default on native iOS.
The native implementation is the following:
Steps to Reproduce
Expected Behavior
The keyboard shouldn't close and the text shouldn't loose it's selection nor should the keyboard close.
Actual Behavior
The text looses selection and the keyboard closes.
Basic Information
Version with issue: 3.4.0.1008975
Last known good version: None, never worked well.
IDE: Visual Studio 2017,Visual Studio 2019 Preview
Platform Target Frameworks: iOS
Nuget Packages:
Affected Devices: iPhone SE, iOS Simulator
Screenshots
Working:
Not working
Reproduction Link
https://github.com/carlos-ferreira/bug-reports/tree/master/Xamarin/Webview