Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Doesn't work properly on Mobile Android Chrome Browser #127

Open
edvanmc opened this issue Jan 18, 2017 · 18 comments
Open

Doesn't work properly on Mobile Android Chrome Browser #127

edvanmc opened this issue Jan 18, 2017 · 18 comments

Comments

@edvanmc
Copy link

edvanmc commented Jan 18, 2017

On Mobile Android Google Chrome browser when inputting a date value like 09/09/1979 within the mask "39/19/9999", the caret misbehave corrupting the inserted value.

It occurs with other masks too.

@edvanmc
Copy link
Author

edvanmc commented Jan 18, 2017

To solve the problem, in the line 142 add the commented code below:

                // Update view and model values
                if(value !== viewValueWithDivisors){
                  controller.$setViewValue(angular.copy(viewValueWithDivisors), 'input');
                  controller.$render();
                  setSelectionRange(viewValueWithDivisors.length);  //Necessary for Android Chrome that is maintaining original cursor position when the value was without divisors.

                }

@lmeliberty
Copy link

+1 Thanks. It's solved for me if i add this line in Js file

@lmeliberty
Copy link

I use this mask with chararacter '-' too, and this fix don't work in this case.

Example = 'ABCDEFGH-EFG-HIJ'
mask="wwwwwwww-www-www"
mask-restrict="reject"

An idea ?

@vinicius-martins
Copy link

Boa tarde!
Tem previsão para liberar release com a correção?

@neysimoes
Copy link

@vinicius-martins @edvanmc english!

@vinicius-martins
Copy link

Sorry!

any idea about when this solution found by edvanmc will be included on a release?

@icaromh
Copy link

icaromh commented Feb 15, 2017

Para resolver inserir após linha 142:

Please, do a pull request for this! @edvanmc

@AndreVicenteW
Copy link

AndreVicenteW commented Feb 24, 2017

I tried do this, in phone mask it is normal, but in CPF mask 999.999.999-99 if i try to write numbers 123.456.789-10 the sequence stays 123.567.910-84

weberamaral added a commit to weberamaral/ngMask that referenced this issue Mar 18, 2017
In all browsers in android devices the keyboard cursor is in the wrong position in fields that have
a mask

closes candreoliveira#32 candreoliveira#58 candreoliveira#127
anderson631 added a commit to anderson631/ngMask that referenced this issue Apr 3, 2017
@leuterio
Copy link

This worked for me:
Inside the input tag add:
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"

@AndreVicenteW
Copy link

@leuterio did you try with 999.999.999-99 mask? I tried here and had same problem ;(

@yardz
Copy link

yardz commented Jun 27, 2017

solution @edvanmc work for me...

if(value !== viewValueWithDivisors){ controller.$setViewValue(angular.copy(viewValueWithDivisors), 'input'); controller.$render(); setSelectionRange(viewValueWithDivisors.length); }

@edvanmc
Copy link
Author

edvanmc commented Jul 28, 2017

Hy dudes,

I have a CPF field on my project, and it works fine.

Bellow my HTML element:

It's not clear to me if the issue was fixed on #136.

Someone tested @weberamaral 's solution ?

I will send a pull request.

@edvanmc edvanmc changed the title Não está funcionando corretamente no Mobile Android Chrome Doesn't work properly on Mobile Android Chrome Browser Jul 28, 2017
@weberamaral
Copy link

weberamaral commented Jul 28, 2017

@edvanmc the pull request has not merged yet.
Check this branch develop

@leuterio
Copy link

leuterio commented Aug 2, 2017

@AndreVicenteW Yeah, I tried it but does'nt worked for me too.
So i put this inside my input tag, something like:
<input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">

NOTE: This worked only on Android 6 or later.

@mathportillo
Copy link

While #136 is not merged, a quick fix is to install the dependency directly from that commit. The following should work on both npm and bower:

"ngMask": "git@github.com:candreoliveira/ngMask.git#a73544ca3a3a2b35558d25ad331235ff65c2fcb2",

@fredlemieux
Copy link

fredlemieux commented Aug 29, 2017

Thanks @mathportillo, your solution seems to work when testing in the emulator on Nexus 6P but not when I tested on two devices (Samsung S7 and Huawei honor 9), I've also tried the amended input tag @leuterio suggested. Has anyone got any other solution to this?

@fredlemieux
Copy link

After further investigation, it seems to be line 36:
input.setSelectionRange(selectionStart, selectionEnd);
the setSelectionRange method doesn't do anything on my Android phone (Ionic App on Samsung S7 with Android 7.0 installed), I've tried making the $timeout longer and using different input types (i.e. tel/text) and it makes no difference. I'm going to to have to remove the masking for the Android version of my app for now :-(

@GabrielStetco
Copy link

GabrielStetco commented Oct 21, 2017

+1
The problem persists even when using autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
Testing on Cordova App on Samsung S7 with Android 7.0 installed

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

No branches or pull requests