Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome on Android (and only Android) Does not allow Decimal with type number and step="any"

I have a problem that I'm not sure if it is a bug, some weirdness about the android keyboard, etc.

Suppose you have this input box somewhere:

    <input type='number' step='any' >

On the default ICS android browser, the Safari mobile browser, iOS Chrome (and probably others), this does exactly what you would expect: it brings up a keyboard with both numbers and a decimal point (because of the step).

However on Chrome on android (and as I said only this version), it brings up a number pad with no decimal.

Does anyone know a workaround?

Additional Details

It appears to be limited to a combination of the Samsung keyboard and Google Chrome. The following works:

  • Google Chrome with 3rd Party Keyboard
  • Main Browser and Firefox with Samsung Keyboard

So, it seems only the combination of both the Samsung keyboard and Chrome that causes a problem.

like image 399
tazz_ben Avatar asked Sep 20 '12 13:09

tazz_ben


People also ask

Why Chrome is not working properly in Android?

Next: Troubleshoot Chrome crash problems If it works in another browser, try uninstalling and reinstalling Chrome. There could be something wrong with your Chrome profile that's causing problems. Uninstall Chrome and make sure to check the box to delete browsing data. Then, reinstall Chrome.

How do you put a decimal number in HTML?

You can also use a decimal value: for example, a step of 0.3 will allow values such as 0.3, 0.6, 0.9 etc, but not 1 or 2. Now you don't get a validation error. Yay! Also note that if you only want to accept positive numbers, you'll want to add min=”0″.


1 Answers

This issue appears to be fixed https://code.google.com/p/chromium/issues/detail?id=151738#c17 . I think this was fixed in Chrome Mobile 36 released June 2014 - it certainly is fixed in Chrome Mobile 47 which is the only version I have on a Samsung phone at the moment.

If you don't have many users, there are two workarounds:

  1. Ask user to install the Google Keyboard and enable it - see https://play.google.com/store/apps/details?id=com.google.android.inputmethod.latin

  2. Ask user to use the native browser (ask user to use the App with the world icon labelled "Internet").

Apps using WebView on Android 4.4 are stuck with Chrome 30 or 33 for the WebView, so I would guess that Samsung Android 4.4 phones using WebView are affected. Using WebView on any other version of Android shouldn't be affected (Android 4.3 or less used the native browser for the WebView and Android 5.0+ should use a version of Chrome without the bug because Chrome WebView updated).

Also relevant is Samsung browser versions by phone and comments about the Samsung browser.

like image 128
robocat Avatar answered Sep 27 '22 22:09

robocat