question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android Information

See original GitHub issue

I have found some information that I hope is useful for Android. I have found that this library still breaks on Galaxy devices. I started to look into what was causing some of these issues. As of right now, Galaxy devices are not registering the keys that are pressed. It instead returns 0 for the keydown/up events. I have written several tests to see if I could replicate the issue and spent several days scratching my head to why they were passing when I could clearly break it.

The Jasmine tests that I have written are similar to yours but they are returning a false positive on input. As you can specify in code what key is pressed and so the mask is working if it receives a keycode. Although if it receives keycode 0 (null in Ascii) it does not know how to handle that and allows input before the mask no limit to the number of characters entered.

Here is some of the tests that I have used for trying to identify the problem. For these tests I was using your sendKey and sendKeys methods.

    beforeEach(function () {
        jasmine.getFixtures().set('<input type="tel" id="test"/>');
        inputField = $('#test');
    });
    describe("SSN", function () {
        var deleteInput = function () {
            for (var i = 0; i < inputField.val().length; i++) {
                inputField.sendKey(keys.BACKSPACE);
            }
        };
        beforeEach(function () {
            inputField.inputmask("999-99-9999");
        });

        it("applies a mask to the field with MaskedInput attribute", function () {
            inputField.val('1');
            expect(inputField.val()).toEqual("1__-__-____");
        });

        it("allows deletion of the input", function () {
            inputField.val('333224444');
            deleteInput();
            expect(inputField.val()).toEqual("");
        });

        it("allows input after deleting input from field", function () {
            inputField.sendKeys('333224444');
            deleteInput();
            expect(inputField.val()).toEqual("");
            inputField.sendKeys("123");
            expect(inputField.val()).toEqual("123-__-____");
        });

        it("allows inserting values with INSERT mode on", function () {
            inputField.sendKey(keys.INSERT);
            inputField.sendKeys("123");
            expect(inputField.val()).toEqual("123-__-____");
        });
    });

Hope this helps with the advance on Android and mobile devices. 😄

Resources: Thread on the return 0 issue: https://code.google.com/p/chromium/issues/detail?id=118639 Test for return 0: http://goo.gl/n7IKjF

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:46 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
wowDaivercommented, Jan 25, 2015

I finded temporary solution for phone mask. Set type input field as “tel”

My device Samsung Galaxy S3

1reaction
br4in3xcommented, Mar 30, 2017

Was facing same issue, and as quick fix - switched to another library. But they also had exactly same problem and it was fixed, check here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Android | Android
Powering your phone, tablet, watch, TV and car. ... When a device goes from just working to actually making life easier, Android is...
Read more >
Android - Secure & Reliable Mobile Operating System
Explore more about Android, a secure mobile operating system with the latest Google updates, which offers personalized devices that fit your needs.
Read more >
The facts - Android is for everyone
The Android Open-Source Project (AOSP) is the core software stack behind the Android OS and consists of the operating system, middleware, and open-source...
Read more >
Android | Definition, History, & Facts | Britannica
Android, operating system for cellular telephones and tablet computers. Android began in 2003 as a project of the American technology company Android Inc., ......
Read more >
What is Android OS? - TechTarget
Android OS is a Linux-based mobile operating system that primarily runs on smartphones and tablets. The Android platform includes an operating system based ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found