nosir / cleave.js

Format input text content when you are typing...
http://nosir.github.io/cleave.js
Apache License 2.0
17.96k stars 1.62k forks source link

blocks option add previous block in mobile #362

Open gurkanuzunca opened 6 years ago

gurkanuzunca commented 6 years ago

i use like this, but when i type a number,it add previous block in chrome mobile browser.

+90 543 6 result; press 5: +90 5 press 4: +90 554 press 3: +90 554 543 press 6: +90 554 543 5436

new Cleave('.mask', {
    blocks: [3,3,3,4],
    numericOnly: true,
    prefix: '+90',
    noImmediatePrefix: true
});
kaYcee commented 6 years ago

I second this, observed the same in Firefox mobile (61.0). Is there a known fix by any chance?

kaYcee commented 6 years ago

Just found out that this issue arises on Samsung phones with Smart Typing enabled on the default Samsung keyboard. This leads to onKeyDown events not being fired and a user-supplied onInput handler being fired twice, thus leading to text accumulation in the field.

rison commented 5 years ago

Yea, I think it's the Smart Typing thing causing the weird behaviour.

Heidschnucke commented 5 years ago

Problem occurs on various devices, e.g. Samsung Galaxy S8 with Android 8+.

The bug comes from this code potentially:

    // fix Android browser type="text" input field
    // cursor not jumping issue
    if (owner.isAndroid) {
        window.setTimeout(function () {
            owner.element.value = newValue;
            Util.setSelection(owner.element, endPos, pps.document, false);
            owner.callOnValueChanged();
        }, 1);

        return;
    }