I'm attempting to load the Facebook sign in page in a WebView
that is running on the Nexus Player. This device outputs to a TV and as such does not have a touch screen.
I can get the sign in page to load without issue, but the user is unable to select the email and password text fields in order to enter their credentials.
Pushing up/down/left/right on the Nexus Player remote results in the web page scrolling, but I'm unable to interact with anything on the page itself.
Things I've tried:
WebView.requestFocus()
after page loads (from here: https://stackoverflow.com/a/3975109/758458)The solution was to execute the following javascript on my WebView
in onPageFinished()
:
webView.loadUrl("javascript:document.getElementsByName('email')[0].focus();");
Obviously this will only work with the Facebook sign in screen, since they have a text field with name 'email'.