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

Does not work on Android WebView #33

Open
vpodk opened this issue Jul 30, 2018 · 6 comments
Open

Does not work on Android WebView #33

vpodk opened this issue Jul 30, 2018 · 6 comments

Comments

@vpodk
Copy link

vpodk commented Jul 30, 2018

Console About WevView
screen shot 2018-07-30 at 12 03 34 am screen shot 2018-07-30 at 12 04 03 am

Feature detection from datalist-polyfill.js file:

19 // Feature detection - let's break here, if it's even already supported
20 if (
21	'list' in dcmnt.createElement('input') &&
22	Boolean(dcmnt.createElement('datalist') && window.HTMLDataListElement)
23 ) {
24	return false;
25 }

Also tested on WebView-based app on real devices:

  • Google Pixel 2
  • Google Pixel
  • Google Pixel XL
  • Moto G4 Play
  • Moto G3
@mfranzke
Copy link
Owner

@vpodk, thanks a lot for your feedback.
Does including the JavaScript file itself lead to any JavaScript errors? And do you mean by that it doesn‘t work that the behaviour of the polyfill wouldn‘t get executed?
Because in general I would expect that the feature detection works correctly as the datalist functionality should be provided natively on Chrome for Android according to caniuse. I‘m not that familiar with Android so that I wouldn‘t know about the differences to their WebView by myself.

@vpodk
Copy link
Author

vpodk commented Jul 30, 2018

@mfranzke, the script itself does not throw any errors. Its feature detection considers that this feature is supported by Android WebView, but it's not.

The caniuse shows just a random numbers for Android column:

May be these are versions of Android operation system, or versions of WebView component, or something completely different.

I came to this script from datalist's Polyfill section on official mozilla.org site where this feature is also marked as supported by WebView in Browser compatibility table:

Need to ask @mdn to update datalist.json file.

There are list of user agents of tested devices where 100% native datalist and this polyfill does not work:

  • Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/PMIS24.107-55-2-17; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Safari/537.36
  • Mozilla/5.0 (Linux; Android 7.1.1; Moto G Play Build/NPI26.48-43; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Safari/537.36
  • Mozilla/5.0 (Linux; Android 8.1.0; Pixel Build/OPM4.171019.021.D1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Safari/537.36
  • Mozilla/5.0 (Linux; Android 9; Pixel 2 Build/PPP5.180610.010; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Safari/537.36

For simple test just run WebView from Android Studio and open your demo page:

Example About WebView
screen shot 2018-07-30 at 12 56 09 pm screen shot 2018-07-30 at 1 04 14 pm

To detect Android WebView you can use User Agent Strings described on developer.chrome.com website. In my case, I added navigator.userAgent.indexOf('; wv) ') to the feature detection.

Hope this helps.

@mitchhentges
Copy link
Collaborator

mitchhentges commented Jul 30, 2018

Hmm, this is interesting 🤔
Ideally, we shouldn't need to check the UA, we should either detect the feature and do nothing, or not detect the feature and polyfill. It's strange that it's not behaving properly.


The caniuse shows just a random numbers for Android column

For what it's worth:

  • For all Android versions up to 4.4.4 (KitKat), the Android webview version was tied to the OS. Updates for the OS would update the webview
  • For Android versions 5.0+, the Android webview version is now decoupled from the OS version, allowing more frequent updates. So, whenever there's a Chrome desktop release, there's an associated Chrome for Android release as well (so, the "67" shown on caniuse is referring to the Chrome version)

reference

Although WebView has been based on Chromium since Android 4.4, the Chromium layer is now updatable from Google Play.

@mfranzke
Copy link
Owner

mfranzke commented Jul 31, 2018

Totally agreed on this, @mitchhentges. What I‘m mostly wondering about is that these UA strings actually report quite new versions of Chrome like e.g. „Chrome 67 on Android (Marshmallow)“, in which I would expect to have the datalist functionality work natively.

vpodk added a commit to vpodk/browser-compat-data that referenced this issue Jul 31, 2018
The `datalist` does not work on Android WebView.
mfranzke/datalist-polyfill#33
ddbeck pushed a commit to mdn/browser-compat-data that referenced this issue Aug 2, 2018
@mfranzke
Copy link
Owner

mfranzke commented Sep 25, 2018

@vpodk, do you have the possibility to even also report this back to the official Google channels (and probably provide the ticket no. as a reference both for caniuse and here) ?

@vpodk
Copy link
Author

vpodk commented Sep 28, 2018

@mfranzke, I did not report any issue to Google's bug tracking system, but I found this one:
https://bugs.chromium.org/p/chromium/issues/detail?id=242455

screen shot 2018-09-27 at 10 54 58 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants