jaridmargolin / formatter.js

Format html inputs to match a specified pattern
http://firstopinion.github.io/formatter.js
2.48k stars 235 forks source link

Incorrect focus when 'persistent': true #86

Open RaduGrama opened 9 years ago

RaduGrama commented 9 years ago

I am experiencing unexpected focus when using 'persistent': true. The page seems to scroll to the last element formatter is applied to, and this is issue appears with formatter.js as well as jquery.formatter.js.

Take a look at http://jsfiddle.net/46FNG/67/, there's an input all the way at the top, then a bunch of
tags, then a few elements that formatter applies to. The page scrolls to those elements at the bottom of the page instead of staying at the top.

paulyi326 commented 9 years ago

I am experiencing the same problem, but only in IE.

imposibrus commented 9 years ago

Same problem, Ubuntu 14.04 x64 in Chrome 45.0.2454.93 and Firefox 40.0.3

khmelevskii commented 9 years ago

+1

dogagenc commented 8 years ago

Same in latest versions of Chrome, Firefox in both of Mac and Windows.

smaury commented 8 years ago

Just made a pull request about this issue: https://github.com/firstopinion/formatter.js/pull/94

Jeff-P commented 8 years ago

Im still having an issue while using the jquery version. Anybody do any hacks to fix it there on file dist/jquery.formatter.min.js

Jeff-P commented 8 years ago

I used this script to get around it <script type="text/javascript"> $( document ).ready(function() { window.scrollTo(0,0); }); </script>

chrislebaron commented 8 years ago

The change @smaury made is the fix! At one point I had tried using @Jeff-P's solution, but it's more of a hack, and changes the scroll position for a user if they refresh the page.