RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.4k stars 2.17k forks source link

On Safari cursor not move to the start position #1940

Open silencerspirit opened 6 years ago

silencerspirit commented 6 years ago

Hello, I have a problem only in the browser Safari and iOS: when I first clicked on input, my cursor has not moved to the original position and remained in place, if I click again, then this problem is no longer and everything works as it should. On all other browsers everything works as it should from the first time. Screenshot: http://prntscr.com/k8tms9 Version input-mask: 4.0.0

tomprats commented 6 years ago

I tested it on a few versions and it looks like it's a problem from version 4 to the current beta. I use

And the code I'm using $("#published_at").inputmask("mm/dd/yyyy hh:mm xm")

RobinHerbots commented 6 years ago

@silencerspirit , See #1891

@tomprats , When there is a major version change you should read the changelog. The date aliases are being refactored.

RobinHerbots commented 6 years ago

@silencerspirit ,

Can you reproduce this on browserstack? Can you retry with version 4.0.1 beta xx

tomprats commented 6 years ago

@RobinHerbots I read through the changelog starting from the previous version I was on (I appreciate the format and thorough detail of it!) but does this mean that the date alias is unusable? I see the notes about it there.

I'd be willing to help fix it if you point me in the right direction

RobinHerbots commented 6 years ago

@tomprats ,

No the date aliases are replaces by on datetime alias which accepts an inputFormat

tomprats commented 6 years ago

There still appear to be bugs. Using $("#published_at").inputmask("mm/dd/yyyy hh:mm xm") allows chrome to function nearly perfectly (although the year becomes 6 digits for some reason). That code on safari on desktop won't let me add anything and always places my cursor at the end of the line.

Then I tried using $("#published_at").inputmask("datetime", {inputFormat: "mm/dd/yyyy hh:mm xm"}), as you suggested above. On chrome there is no change, the year can still be 6 digits. On desktop safari it is completely broken. The input goes through the mask yet still tracks how far it is, resulting in something like the picture (before and after typing several 1s)

before after

I also noticed I'm using a form input of type datetime-local, not sure if that affects it. These tests were also done with version 4.0.1-beta.25 (the latest build at this time)

tomprats commented 6 years ago

Any update on this @RobinHerbots?

MiXALK commented 5 years ago

The same problem is observed in Safari with version 4.0.4