Search code examples
javascriptinput-maskjquery-inputmask

Robin input mask : iPhone shows pure numeric keyboard for decimal input


I have this MCVE:

<input type="text" name="price" placeholder="Price" id="price">

Inputmask.extendAliases({
     'SfdCurrency': {
         alias:                  "numeric", /* can be also decimal */
         digits:                 2,
         digitsOptional:         false,
         radixPoint:             ",",  /* can be also . */
});

$("[name='price']").inputmask({
     alias: 'SfdCurrency',
});

On iPhone [10 & 11 & 12] the pure numeric keyboard is shown [see the below screenshot] which doesn't have the comma which means that in order to enter digits after the comma the user has to click "behind" the comma. Android shows a keyboard with comma so any decimal number can be entered without an additional click after the comma sign.

enter image description here

My question:

What am I doing wrong because iPhone doesn't show a keyboard with comma for a decimal number?


Solution

  • Robin answered me in the Github issue section:

    Can you set the inputmode option to decimal.

    Yes, this fixed the problem and the comma appears now also on the iPhone keyboard.

    enter image description here