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

ability to focus webview #278

Closed
alidcast opened this issue Jan 25, 2019 · 21 comments
Closed

ability to focus webview #278

alidcast opened this issue Jan 25, 2019 · 21 comments
Labels
Help wanted Extra attention is needed Type: feature request New feature or request

Comments

@alidcast
Copy link

alidcast commented Jan 25, 2019

I'm trying to embed an editor inside a webview, but clicking on the webview itself does not seem to focus it (so that the keyboard can open and user can edit). Is it possible to focus the webview?

note: editing inside webview works on the simulator (where I can type via desktop keyboard).

@jaulz
Copy link

jaulz commented Feb 4, 2019

I might look for something similar... on iPhone I need to tap the WebView first to gain focus and only the second tap is actually triggering a tap in the WebView. Though on iPad the very first tap is handled by the WebView.

@Nantris
Copy link

Nantris commented Mar 1, 2019

This would be such an enormous deal for usability, I can't overstate it. Webviews are often used to wrap editors and if you can't focus the Webview for the user things just feel terrible.

@jamonholmgren jamonholmgren added Type: feature request New feature or request Help wanted Extra attention is needed labels Mar 7, 2019
@jamonholmgren
Copy link
Member

We would love someone to take the initiative on this and make a PR! ❤️

@Wilson-Lim
Copy link

We need this feature too.

@jamonholmgren
Copy link
Member

There's a pull request in progress now for this, #540. Help testing it would be amazing @Wilson-Lim, @slapbox , @jaulz, @alidcastano ! Thanks to @ericlewis

@Nantris
Copy link

Nantris commented Apr 26, 2019

Unfortunately I can't test this (using Expo still at the moment) but thanks so much to @ericlewis for the PR to @jamonholmgren for keeping on top of everything!

@jaulz
Copy link

jaulz commented Apr 29, 2019

@ericlewis @jamonholmgren thanks! I'm not an expert in Objective C so please excuse my question but would this piece of code also be reusable for a focus method on the WebView?

@ericlewis
Copy link
Contributor

ericlewis commented Apr 29, 2019 via email

@ericlewis
Copy link
Contributor

@jaulz or do you mean a method you can call to “focus” the webview? There is no method to call in this case (I’m not sure how that would work either) what this allows is for the javascript in the webview to call focus on a text element and the keyboard will display without user interaction. This isn’t enabled by default on iOS.

@Nantris
Copy link

Nantris commented Apr 29, 2019

@ericlewis - I can programatically focus within a Webview as is, but that's not enough to get the keyboard to appear unless the user has already focused the Webview itself. Both the Webview AND a text editable element on the page must be focused for the keyboard to show. Once a Webview has been focused once, focusing an inner element seems to be enough to show the keyboard.

All of that is the case for Android at least.

@ericlewis
Copy link
Contributor

ericlewis commented Apr 29, 2019 via email

@jamonholmgren
Copy link
Member

I assume #540 solves your problem, @alidcastano ? If so, we can close this.

@Nantris
Copy link

Nantris commented May 7, 2019

@jamonholmgren #540 doesn't yet resolve the problem in my view.

@alidcast
Copy link
Author

alidcast commented May 7, 2019

i, unfortunately, haven't had a chance to check but will go ahead and close this issue - thanks @amonholmgren (and @ericlewis!)

@alidcast alidcast closed this as completed May 7, 2019
@ericlewis
Copy link
Contributor

@slapbox if you want to open an android specific issue- go ahead! #540 was iOS only.

@gianpaj
Copy link
Contributor

gianpaj commented May 26, 2019

Just asking here in case a miracle is possible.
Is there any way to automatically focus on an input field inside iframe?
I don't control the iframe as it's the bank credit card iframe.

@ericlewis
Copy link
Contributor

ericlewis commented May 27, 2019 via email

@maxKimoby
Copy link

Is there any way this could prop could be implemented on android? If not, how can I programmatically show they keyboard when an input has focus in the webview? I tried this.webView.requestFocus() but this is not working.

@Nantris
Copy link

Nantris commented Oct 31, 2019

There's no way to programmatically focus the webview on Android. I think this feature is desperately needed.

@rmanalo-getdevs
Copy link

Focus still not working in android

@Nantris
Copy link

Nantris commented Jun 4, 2020

I advise everybody to move this discussion over to #1172

Indeed, focusing is still not implemented on Android - so this really shouldn't have been closed - but it is.

@react-native-webview react-native-webview locked and limited conversation to collaborators Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help wanted Extra attention is needed Type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants